Dynamic loading on UNIX

Looks like SDL_Init looks for libSDLx11.so.0.9,
but it does not look into the directories that are in
my LD_LIBRARY_PATH.

Don’t you think it should ?

It should, and does on my system.

i.e., if I put libSDLx11.so.0.9 in /usr/local/lib and
set LD_LIBRARY_PATH to contain /usr/local/lib, I think
it should work.

You might look in /etc/ld.so.conf to see if /usr/local/lib is there.
SDL uses the dlopen API to dynamically load the library, and that
should use the LD_LIBRARY_PATH… unless the binary is set-uid root,
in which case it will only use the built-in and system library paths.

See ya!
-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/

Unless the program is suid…On Mon, Dec 14, 1998 at 07:58:17AM -0800, Sam Lantinga wrote:

Looks like SDL_Init looks for libSDLx11.so.0.9,
but it does not look into the directories that are in
my LD_LIBRARY_PATH.

Don’t you think it should ?

It should, and does on my system.


– Michael Samuel

Looks like SDL_Init looks for libSDLx11.so.0.9,
but it does not look into the directories that are in
my LD_LIBRARY_PATH.

Don’t you think it should ?

It should, and does on my system.

i.e., if I put libSDLx11.so.0.9 in /usr/local/lib and
set LD_LIBRARY_PATH to contain /usr/local/lib, I think
it should work.

You might look in /etc/ld.so.conf to see if /usr/local/lib is there.
SDL uses the dlopen API to dynamically load the library, and that
should use the LD_LIBRARY_PATH… unless the binary is set-uid root,
in which case it will only use the built-in and system library paths.

dlopen is cool… from the man page…:

If filename is not an
absolute path (i.e., it does not begin with a “/”), then
the file is searched for in the following locations:

          A colon-separated list of directories in the user's
          LD_LIBRARY path environment variable.

          The     list     of    libraries    specified    in
          /etc/ld.so.cache.

          /usr/lib, followed by /lib.On Mon, 14 Dec 1998, Sam Lantinga wrote:

Scott M. Stone <sstone at pht.com, sstone at pht.co.jp>
Head of TurboLinux Development/Systems Administrator
Pacific HiTech, Inc (USA) / Pacific HiTech, KK (Japan)