This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GNU linker
- From: "Arun Saini , Gurgaon" <arun at ggn dot hcltech dot com>
- To: baardm at ifi dot uio dot no
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 18 Feb 2002 21:38:47 +0530
- Subject: Re: GNU linker
>How do ld know which library to load for an application?
It doesn't. It searches for undefined symbols in libraries specified to it,
in the order in which they are specified (searching iteratively if
required).
>Many applications using sockets run the socket-code from libc,
>but if the application is using pthreads, it will need to use
>the socket-calls in libpthread. How does ld know which library to
>choose?
Specify -lpthread on the command line while linking the executable. Actually
you need to place it before -lc which if not specified explicitly occurs
after the user specified libraries in the search order.