tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY: linking question
@ 1997-05-29 17:52 Ellen Davis
  0 siblings, 0 replies; only message in thread
From: Ellen Davis @ 1997-05-29 17:52 UTC (permalink / raw)
  To: tru64-unix-managers

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-05-29 17:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-05-29 17:52 SUMMARY: linking question Ellen Davis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox