This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Partial Static Linkage
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Brian McGrew <brian at visionpro dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 29 Nov 2010 17:22:39 +0000
- Subject: Re: Partial Static Linkage
- References: <C9190BFD.15CE7%brian@visionpro.com> <4CF3D01A.5080902@qnx.com>
On 29 November 2010 16:08, Ryan Mansfield wrote:
> On 10-11-29 10:51 AM, Brian McGrew wrote:
>>
>> Good morning all!
>>
>> Is there a way to tell the compiler/linker to use whatever static
>> libraries
>> are available first and then fall back to dynamic libraries only if static
>> fails???
>>
>> Iée got some libraries that Iée created that I need to link in and they
>> are static. ÂHowever, some of the system libraries I rely on (like libXt)
>> have no static versions. ÂI need my program to pick up the static versions
>> of my libraries and then link to the dynamic versions of the system
>> libraries that have no static counterparts.
>>
>> Is this doable??? ÂHow?
>
> Use the -Bstatic and -Bdynamic options. e.g.
>
> -Bstatic <your static libs> -Bdynamic
Or simply don't have shared versions of your libs in the dirs searched
by the linker. If the linker only finds a static lib in a directory it
will use that, even if a shared lib with the same name exists in
another directory later in the list of searched directories.