This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Static and Dynamic Linking with GCC


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]