[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

ctypes CDLL - which paths are searched?

Helmut Jarausch

1/21/2008 5:25:00 PM

Hi,

how can I specify the paths to be searched for a dynamic library
to be loaded by ctypes' CDLL class on a Linux system.

Do I have to set os.environment['LD_LIBRARY_PATH'] ?

Many thanks for a hint,
Helmut.

--
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
4 Answers

Thomas Heller

1/21/2008 8:43:00 PM

0

Helmut Jarausch schrieb:
> Hi,
>
> how can I specify the paths to be searched for a dynamic library
> to be loaded by ctypes' CDLL class on a Linux system.
>
> Do I have to set os.environment['LD_LIBRARY_PATH'] ?
>

ctypes passes the argument given to CDLL(path) straight to
the dlopen(3) call, so your system documentation should tell you.

Thomas

Helmut Jarausch

1/22/2008 12:59:00 PM

0

Thomas Heller wrote:
> Helmut Jarausch schrieb:
>> Hi,
>>
>> how can I specify the paths to be searched for a dynamic library
>> to be loaded by ctypes' CDLL class on a Linux system.
>>
>> Do I have to set os.environment['LD_LIBRARY_PATH'] ?
>>
>
> ctypes passes the argument given to CDLL(path) straight to
> the dlopen(3) call, so your system documentation should tell you.
>

Thanks,

but then it's difficult to use CDLL. Setting
os.environ['LD_LIBRARY_PATH'] within the script which
calls CDLL is too late.
What other methods are possible rather than put an explicit
export LD_LIBRARY_PATH=...
before running the script, if I don't want to put the dynamic
library into a standard system library.

Many thanks,
Helmut.



--
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany

Helmut Jarausch

1/22/2008 12:59:00 PM

0

Thomas Heller wrote:
> Helmut Jarausch schrieb:
>> Hi,
>>
>> how can I specify the paths to be searched for a dynamic library
>> to be loaded by ctypes' CDLL class on a Linux system.
>>
>> Do I have to set os.environment['LD_LIBRARY_PATH'] ?
>>
>
> ctypes passes the argument given to CDLL(path) straight to
> the dlopen(3) call, so your system documentation should tell you.
>

Thanks,

but then it's difficult to use CDLL. Setting
os.environ['LD_LIBRARY_PATH'] within the script which
calls CDLL is too late.
What other methods are possible rather than put an explicit
export LD_LIBRARY_PATH=...
before running the script, if I don't want to put the dynamic
library into a standard system library.

Many thanks,
Helmut.



--
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany

Thomas Heller

1/22/2008 1:43:00 PM

0

Helmut Jarausch schrieb:
> Thomas Heller wrote:
>> Helmut Jarausch schrieb:
>>> Hi,
>>>
>>> how can I specify the paths to be searched for a dynamic library
>>> to be loaded by ctypes' CDLL class on a Linux system.
>>>
>>> Do I have to set os.environment['LD_LIBRARY_PATH'] ?
>>>
>>
>> ctypes passes the argument given to CDLL(path) straight to
>> the dlopen(3) call, so your system documentation should tell you.
>>
>
> Thanks,
>
> but then it's difficult to use CDLL. Setting
> os.environ['LD_LIBRARY_PATH'] within the script which
> calls CDLL is too late.
> What other methods are possible rather than put an explicit
> export LD_LIBRARY_PATH=...
> before running the script, if I don't want to put the dynamic
> library into a standard system library.

I guess you can also use an absolute pathname (but the dlopen(3)
manpage should tell you more. I'm not too familiar with linux).

Thomas