ctypes CDLL - which paths are searched?

Helmut Jarausch jarausch at igpm.rwth-aachen.de
Tue Jan 22 13:58:55 CET 2008

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.


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 Jarausch

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

More information about the Python-list mailing list