At 09:59 AM 5/27/97 -0400, you wrote:
I posed a question about the order of libraries search when linking, in
particular with use of the -L option.
Thanks to
Alex Garthwaite
Jonathan Rozes
Jonathan summed it up best:
>
>The search order is to go through the directory list and search for a
>shared library, then go through the list again and search for a static
>library. Thus, the linker is finding /usr/shlib/libdb.so before it finds
>/usr/local/lib/libdb.a. You can fix this one of two ways:
>
>1. Specify the actual archive file instead of using the -l switch, as in
> cc -o foo foo.c /usr/local/lib/libdb.a
>
>2. Pass the -oldstyle_liblookup flag to the linker, causing it to search
> each directory once, first for the shared lib, then for the archive:
> cc -o foo foo.c -L/usr/local/lib -Wl,-oldstyle_liblookup -ldb
>
Ellen Davis
Received on Thu May 29 1997 - 20:01:39 NZST