<OT> MS finally gets a little smarter

Kurt Wall kwall
Mon May 17 11:53:17 PDT 2004


Quoth James McDonald:
> 
> My question is:
> 
> Lets say you had two versions of libmytestlib.so in /usr/lib and 
> /usr/local/lib how do you tell it to pick up one particular library over 
> another...

Note that a properly-compiled library doesn't use libmytestlib.so. 
Rather, it uses explicit library versons, say, libmytestlib-1.2.so, and 
and allows the dynamic linker/loader (ld.so an GNU libc systems) to
figure out the library version at run time. 

At compile time, you modify the library path fed to the compiler so that
one gets found before the other. Compare 

$ gcc foo.c -L /usr/lib -L /usr/local/lib -lmytestlib

to

$ gcc foo.c -L /usr/local/lib -L /usr/lib -lmytestlib

> I presume LD_LIBRARY_PATH is parsed left to right but what happens when 
> you want to explicitly assign individual libs ?

You use LD_LIBRARY_PATH at run time.

> Ohh and BTW barefeet and a hot cow pat can be heaven on a cold morning.

Eew.

Kurt
-- 
2180, U.S. History question:
	What 20th Century U.S. President was almost impeached and what
office did he later hold?


More information about the Linux-users mailing list