Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Aug 2005 21:26:11 +0100
From:      Jonathon McKitrick <jcm@FreeBSD-uk.eu.org>
To:        Giorgos Keramidas <keramida@ceid.upatras.gr>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Forcing symbol resolution in lib rather than bin
Message-ID:  <20050819202611.GA80352@dogma.freebsd-uk.eu.org>
In-Reply-To: <20050819201440.GA9246@flame.pc>
References:  <20050819191335.GA76538@dogma.freebsd-uk.eu.org> <20050819194748.GA7138@flame.pc> <20050819200338.GA77739@dogma.freebsd-uk.eu.org> <20050819201440.GA9246@flame.pc>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 19, 2005 at 11:14:40PM +0300, Giorgos Keramidas wrote:
: On 2005-08-19 21:03, Jonathon McKitrick <jcm@FreeBSD-uk.eu.org> 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 <bsd.xxx.mk>  ;-)
: >
: > 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050819202611.GA80352>