From owner-freebsd-questions@FreeBSD.ORG Fri Aug 19 20:26:20 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A123116A41F for ; Fri, 19 Aug 2005 20:26:20 +0000 (GMT) (envelope-from jcm@FreeBSD-uk.eu.org) Received: from yearning.mcc.ac.uk (yearning.mcc.ac.uk [130.88.203.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id 36C8843D53 for ; Fri, 19 Aug 2005 20:26:20 +0000 (GMT) (envelope-from jcm@FreeBSD-uk.eu.org) Received: from dogma.freebsd-uk.eu.org ([130.88.200.97]) by yearning.mcc.ac.uk with esmtp (Exim 4.51 (FreeBSD)) id 1E6DRQ-000A6X-2U; Fri, 19 Aug 2005 21:26:16 +0100 Received: from dogma.freebsd-uk.eu.org (localhost [127.0.0.1]) by dogma.freebsd-uk.eu.org (8.13.1/8.13.1) with ESMTP id j7JKQBiQ080371; Fri, 19 Aug 2005 21:26:15 +0100 (BST) (envelope-from jcm@dogma.freebsd-uk.eu.org) Received: (from jcm@localhost) by dogma.freebsd-uk.eu.org (8.13.1/8.12.6/Submit) id j7JKQBTO080370; Fri, 19 Aug 2005 21:26:11 +0100 (BST) Date: Fri, 19 Aug 2005 21:26:11 +0100 From: Jonathon McKitrick To: Giorgos Keramidas Message-ID: <20050819202611.GA80352@dogma.freebsd-uk.eu.org> References: <20050819191335.GA76538@dogma.freebsd-uk.eu.org> <20050819194748.GA7138@flame.pc> <20050819200338.GA77739@dogma.freebsd-uk.eu.org> <20050819201440.GA9246@flame.pc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050819201440.GA9246@flame.pc> User-Agent: Mutt/1.4i Cc: freebsd-questions@freebsd.org Subject: Re: Forcing symbol resolution in lib rather than bin X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2005 20:26:20 -0000 On Fri, Aug 19, 2005 at 11:14:40PM +0300, Giorgos Keramidas wrote: : On 2005-08-19 21:03, Jonathon McKitrick wrote: : >On Fri, Aug 19, 2005 at 10:47:48PM +0300, Giorgos Keramidas wrote: : >: # flame:/tmp/jcm-lib/foobar$ LD_LIBRARY_PATH=`pwd`/../libbar ./foobar : >: # libfoo initialized at 0x80062a8a0 : >: # libbar initialized at 0x4004e4 : >: # flame:/tmp/jcm-lib/foobar$ : > : > Hmmm. I'm using my own makefile setup rather than the standard one. I know : > you're a big fan of ;-) : > : > Doesn't ld *statically* link code from .a archives? : : 'statically' is such an overloaded term I prefer to avoid using it. : : The C linker will include the body of functions defined in non-shared : libraries into every shared object that references them, AFAIK. This is : obvious if you run nm(1) on libbar.so of the example above, because the : libfoo_init() function is listed as 'T'. I think that's what you want : by making the libfoo.a library non-shared in the first place. Got it! I recalled something des or phk wrote me a while ago, then I skimmed the manpage again. I have to put the .a files AFTER the object files where the unresolved symbol is found. Jonathon McKitrick -- Hoppiness is a good beer.