ctypes CDLL - which paths are searched?

Discussion in 'Python' started by Helmut Jarausch, Jan 21, 2008.

  1. 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
    Helmut Jarausch, Jan 21, 2008
    #1
    1. Advertising

  2. 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
    Thomas Heller, Jan 21, 2008
    #2
    1. Advertising

  3. 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, Jan 22, 2008
    #3
  4. 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, Jan 22, 2008
    #4
  5. 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
    Thomas Heller, Jan 22, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?ZGF2aWQ=?=
    Replies:
    3
    Views:
    2,888
    =?Utf-8?B?ZGF2aWQ=?=
    Sep 29, 2004
  2. Roland
    Replies:
    3
    Views:
    3,165
    SpaceGirl
    Dec 2, 2004
  3. Noah
    Replies:
    5
    Views:
    780
  4. Marcus.CM

    Segmentation Fault on CDLL reloading

    Marcus.CM, Aug 30, 2008, in forum: Python
    Replies:
    1
    Views:
    285
    Diez B. Roggisch
    Aug 30, 2008
  5. Ohad Lutzky

    Paths, gentleman, paths

    Ohad Lutzky, Nov 6, 2006, in forum: Ruby
    Replies:
    2
    Views:
    189
    David Vallner
    Nov 7, 2006
Loading...

Share This Page