linking

ron.peterson at yellowbank.com ron.peterson at yellowbank.com
Wed Mar 19 13:05:51 EST 2003


I'm sure this is pretty basic, but I'm having a hard time tracking this
info down.

Let's say I have both a shared and a static version of the same library
- libalib.a and libalib.so.  If they both reside in the same directory,
which one will get linked?

Say for the sake of argument that shared libraries are linked first.
Then if several directories are being searched (-L<dir1> -L<dir2>) will
the library search order be:

(a) dir1/shared dir2/shared dir1/static dir2/static
or
(b) dir1/shared dir1/static dir2/shared dir2/static

The article on using shared libaries at

http://www.linux-mag.com/2002-04/compile_01.html

seems to indicate that dlfcn.h/-ldl is used to incorportate shared
library functions into a program.  Does this imply that my previous two
questions are nonsensical?  I.E. - a program is written to either use
shared or static libraries, but not both?

-- 
Ron Peterson                   -o)
87 Taylor Street               /\\
Granby, MA  01033             _\_v
https://www.yellowbank.com/   ---- 



More information about the Discuss mailing list