This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: Partial Static Linkage


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.


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