This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: linking question
- From: Ian Lance Taylor <ian at airs dot com>
- To: Karsten Fuhrmann <karsten_fuhrmann at cartoon-film dot de>
- Cc: binutils at sources dot redhat dot com
- Date: 21 Dec 2004 11:10:41 -0500
- Subject: Re: linking question
- References: <477BCD18-5369-11D9-AEBF-000A95DC1E96@cartoon-film.de>
Karsten Fuhrmann <karsten_fuhrmann@cartoon-film.de> writes:
> I want to compile a c program with both static and dynamic linking in
> the same program, e.g. i want to link against LIB_A static but
> against LIB_B shared.
> I dicovered the static and dy options in ld but it seems to me that it
> is only possible to link at whole static or dynamic, but not mixed.
The -Bstatic and -Bdynamic linker options apply only to libraries
which follow them, so you can do:
-Bstatic LIB_A -Bdynamic LIB_B
When linking from the gcc command line, you will need to use -Wl, as
in:
-Wl,-Bstatic LIB_A -Wl,-Bdynamic LIB_B
Ian