On 11/29/10 9:22 AM, "Jonathan Wakely" <jwakely.gcc@xxxxxxxxx> wrote: > 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. Ah, thank you! Now that did what I wanted it to do! I build shared and static versions of my libraries and place them in /lib and /lib-static accordingly. Putting /lib-static first on the linker path did just what I wanted to do. So simple. Why didn't I think of that??? -b