From: Ellen Davis <daviser () email ! uc ! edu>
To: tru64-unix-managers
Subject: SUMMARY: linking question
Date: Thu, 29 May 1997 17:52:56 +0000 [thread overview]
Message-ID: <96078612210707.tru64-unix-managers.marc@archive.invalid> (raw)
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
reply other threads:[~1997-05-29 17:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox