Paul Smith <psm...@gnu.org> writes:
> Well, of course I was assuming that your link line would add "-L." or
> similar so that you know that the local directory is always searched
> first.

Even that will typically prefer ./libfoo.so over ./libfoo.a unless
you're also using -static or similar.

> I don't have time to check it to be sure, but I have a vague memory that
> "-lfoo" and "libfoo.a" are not equivalent to the linker: for the former
> the linker only pulls in objects which contain symbols that are actually
> needed, while in the latter the link unconditionally pulls in all the
> objects in the library.  But I could be imagining this.

I've never heard of this and it's certainly not the case that writing
libfoo.a pulls in unreferenced symbols with default linker options.
Normally that is achieved by

  -Wl,-whole-archive libfoo.a -Wl,-no-whole-archive

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to