[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Linking both static and shared libraries with G++
From: |
Tristan Van Berkom |
Subject: |
Re: Linking both static and shared libraries with G++ |
Date: |
Wed, 31 Mar 2004 10:59:59 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225 |
steve.shave@syntegra.com wrote:
Hi Tristan
Thanks for the reply.
I've tried with the -l which does not take the lib or .a
+ I've tried with the ld -B static -B dynamic flags which also do not seem to
work.
Ok, now you've refreshed my memory ;-)
its -Bstatic and -Bdynamic (not -B static and -B dynamic).
Note that with the significance of the order of objects to link on the
`ld' command line, you may need to specify these flags a few times.
example:
% ld -o my_program -Bdynamic -lc -lm -Bstatic -lgobject -lglib \
-Bdynamic -lGL -Bstatic -lXlib ...
In this example, you link libc, libm, libGL dynamicly and you link
libgobject, libglib and libXlib staticly, but still in a specific order.
If you want some helpfull output from `ld' you can use the map option:
% ld -o myprogram -la -lb -lc... -Map mapfile
At least in the mapfile you can check which object files (archive or shared)
that were used in the link.
HTH,
-Tristan