Can't read shared library

Linux specific forum
DarkDragon
Addict
Addict
Posts: 2345
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

bembulak wrote:Sounds silly, but try to set FULL (absolute) path to the lib, like: "/usr/lib/libastro.so".

I had same problem with a lib a few days ago. And not every.

I know, it's dirty but it might work. I've already got some problems with the LD_PATH variable unter PB-Linux, but don't know why.
Here it doesn't even work with the full path. Just try yourself: compile a lib with
pbcompiler yourfile.pb -so test.dll
@Cpl.Bator:

I will try it out, but I'm wondering why it works with other libs and not with the lib coded in PureBasic.
bye,
Daniel
Anonymous

Post by Anonymous »

but I'm wondering why it works with other libs and not with the lib coded in PureBasic.
Do you have a code for test here ?
User avatar
flaith
Enthusiast
Enthusiast
Posts: 704
Joined: Mon Apr 25, 2005 9:28 pm
Location: $300:20 58 FC 60 - Rennes
Contact:

Post by flaith »

i also tried to understand why sometimes it works and sometimes it doesn't.
Two examples (4.10B1) :

file DLL.pb

Code: Select all

ProcedureDLL.l addition(a.l, b.l)
  ProcedureReturn a + b
EndProcedure
file testDLL.pb

Code: Select all

If OpenLibrary(0, "./DLL.so")
  result = CallFunction(0, "addition",5,3)
  Debug result
  CloseLibrary(0)
Else
  MessageRequester("ERROR","Cannot open DLL.so")
  End
EndIf
it works, after that i added a second procedure :

Code: Select all

ProcedureDLL.l addition(a.l, b.l)
  ProcedureReturn a + b
EndProcedure

ProcedureDLL.l error(texte.s)
  ProcedureReturn MessageRequester("Error",texte)
EndProcedure
this time it doesn't work because of the messagerequester :?
“Fear is a reaction. Courage is a decision.” - WC
John Duchek
User
User
Posts: 83
Joined: Mon May 16, 2005 4:19 pm
Location: St. Louis, MO

Cpl. Bator fixes my problem

Post by John Duchek »

using "./astrolib.so" works. I just don't get now why I didn't need that for libxine.so that is in the same directory, unless it isn't loading that copy....

Thanks,

John
John R. Duchek
St. Louis,MO
Thalius
Enthusiast
Enthusiast
Posts: 711
Joined: Thu Jul 17, 2003 4:15 pm
Contact:

Post by Thalius »

check which libs are locted in
/usr/lib
/usr/local/lib

usually without a path libs are preferred opened from there - so copying the .so s there or adding your applications /lib path to the LD_LIBRARY_PATH assign.

Thalius
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! ;)"
Post Reply