same function name in multiple archives - bad idea?
PMahan at adaranet.com
Tue Feb 1 18:21:46 UTC 2011
> -----Original Message-----
> From: owner-freebsd-questions at freebsd.org [mailto:owner-freebsd-
> questions at freebsd.org] On Behalf Of Anton Shterenlikht
> Sent: Tuesday, February 01, 2011 9:08 AM
> To: freebsd-questions at freebsd.org
> Subject: same function name in multiple archives - bad idea?
> Is it wrong to have functions with the same name
> in multiple archives? E.g:
> % ar -t /usr/local/lib/libslatec.a | grep fdump.o
> % ar -t /usr/local/lib/libcmlib.a | grep fdump.o
> Which "fdump" function will be used if I then link
> against -larchive1.a -larchive2.a?
> And is there an easy way to find functions belonging
> in multiple archives?
I believe for ELF images the linker will stop looking after finding it, so the
order of -l<library> controls which one will be used. If you want to see which
one was used during linking, use the ld options '-M -Map <mapfile> --cref' which
will create a map file with cross references.
More information about the freebsd-questions