From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2594 invoked by alias); 27 Sep 2012 16:06:28 -0000 Received: (qmail 2560 invoked by uid 22791); 27 Sep 2012 16:06:22 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ie0-f175.google.com (HELO mail-ie0-f175.google.com) (209.85.223.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Sep 2012 16:06:08 +0000 Received: by iebc13 with SMTP id c13so5698257ieb.20 for ; Thu, 27 Sep 2012 09:06:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.15.132 with SMTP id x4mr3927158igc.58.1348761968138; Thu, 27 Sep 2012 09:06:08 -0700 (PDT) Received: by 10.42.197.202 with HTTP; Thu, 27 Sep 2012 09:06:08 -0700 (PDT) In-Reply-To: <680BABF85B31BC4DB6E3E4E33D569F4D0AC12D1B@NHEXCH2.allegro.msad> References: <680BABF85B31BC4DB6E3E4E33D569F4D0AC12D1B@NHEXCH2.allegro.msad> Date: Thu, 27 Sep 2012 16:06:00 -0000 Message-ID: Subject: Re: is there any way to change the order of name resolution in linking (aside from putting the libraries in the right order?) From: Jonathan Wakely To: "Feuerbacher, Alan" Cc: Ian Lance Taylor , Dan Hitt , "gcc-help@gcc.gnu.org" Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2012-09/txt/msg00233.txt.bz2 On 27 September 2012 15:05, Feuerbacher, Alan wrote: > Ian Lance Taylor wrote: > > >> One thing that may work, if you are using the GNU linker or something >> reasonably compatible, is >> -Wl,--whole-archive,-lMYLIB,-Wl,--no-whole-archive >> >> That will link in the entire contents of the library, so all the >> symbols defined in the library will be available. > > I'm trying something like that for a related purpose, but for it to work you have to replace the "," after "MYLIB" with a space. Otherwise gcc complains about an invalid option "-Wl". I expect the linker complains about that option, not GCC. This should also work: -Wl,--whole-archive,-lMYLIB,--no-whole-archive