Hiding symbols in a static library

Ian Lance Taylor iant@google.com
Sun Sep 27 07:38:00 GMT 2009


Erik de Castro Lopo <mle+tools@mega-nerd.com> writes:

> I have a user of my library that is complaining about private symbols in
> my library clashing with the priviate symbols of another library. I
> suggested that they should use the dynamically linked version of my
> library which has all private symbols hidden by means of a version
> script.
>
> This has not satisfied this user who insists on needing to statically
> link. That leads me here, to ask if there is a way to hide private 
> symbols in a static library.

If you are talking about an archive, and if one object in an archive
has to refer to private symbols in another object in the archive, then
the answer is no.

If it's OK to use ld -r instead of building an archive, then it may
work to use ld -r with --retain-symbols-file.

Ian



More information about the Binutils mailing list