This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Static and Dynamic Linking with GCC
- To: Dan Mergens <dan at photon dot com>
- Subject: Re: Static and Dynamic Linking with GCC
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Fri, 20 Jul 2001 14:42:05 -0700
- Cc: gcc at gcc dot gnu dot org
- References: <3B58A22C.9D84160E@photon.com>
On Fri, Jul 20, 2001 at 02:27:08PM -0700, Dan Mergens wrote:
> Is it possible to link with both static and dynamic libraries on a gcc
> compile line? The -static option prevents dynamic linking, and in
> version 3 you can choose the link mode for libgcc. However, I want to
> know if I can specify the libraries to be link statically or
> dynamically. For example, in IRIX you can do the following:
>
> CC a.o -B static -lfoo -Bdynamic -lbar
>
> which will link which libfoo.a, libbar.so, and the standard .so's
Assuming you are using the GNU binutils, do
# gcc a.o -Wl,-Bstatic -lfoo -Wl,-Bdynamic -lbar
H.J.