Re: Hiding symbols in shared library
- From: "Carl Burch" <cdb@xxxxxxxxxx>
- Date: 9 Jun 2006 15:15:02 -0700
Henrik Goldman wrote:
I agree. Can you say exactly which linker option on which
operating system gives the feature you want? Quoting the man page for
that option would help, as I may not have access to the type of system
you cite.
For instance on linux we have linker scripts:
http://unixhelp.ed.ac.uk/CGI/man-cgi?ld
Notice the switch --version-script. This is a good one because I can create
simple scripts like:
mylib
{
global:
symbolA;
symbolB;
symbolC;
local:
*;
};
Thanks for the URL, that makes it clear that what you're talking
about is the aside in the Linux ld(1) man page :
You can also use the version script to control what symbols
should
be added to the dynamic symbol table if the output format supports
it. See the description of --version-script in @ref{VERSION}.
So what you're concerned about is whether the symbols are added to the
default
export list or subtracted from them. In my original answer I
inadvertantly gave
you the subtractive answer, while you wanted the additive option. On
HP-UX that's :
+e symbol When building a shared library or program,
mark
the symbol for export to the dynamic loader.
Only
symbols explicitly marked are exported. When
building a shared library, calls to symbols
that
are not exported are resolved internally.
If you use the +e or +ee option with -B
symbolic,
references to the symbol specified are
resolved
internally if defined. The runtime behavior
may
be different from using +e alone.
You can specify more than one symbol on the
command line with multiple option-symbol
pairs,
that is, each symbol you specify must be
preceded
by the +e option.
There's also the +ee option, with slightly different semantics with
regard to whether it changes the default export behavior. It sounds
more like the Linux feature you cite, since it leaves the default
exported symbol list in place, while +e empties the list before adding
the symbol(s) you want. Which behavior is better depends on whether
you want tight control or still want to default some symbols' behavior.
Once you start playing with symbol visibility you're likely to have
to figure out symbols that are added by the implementation, so +e is
probably a better choice. I highly recommend the "HP-UX Linker and
Library User's Guide" at http://docs.hp.com/en/B2355-90655/index.html.
- Carl Burch
HP WDB Team
.
- Follow-Ups:
- Re: Hiding symbols in shared library
- From: Henrik Goldman
- Re: Hiding symbols in shared library
- References:
- Hiding symbols in shared library
- From: Henrik Goldman
- Re: Hiding symbols in shared library
- From: Carl Burch
- Re: Hiding symbols in shared library
- From: Henrik Goldman
- Re: Hiding symbols in shared library
- From: Carl Burch
- Re: Hiding symbols in shared library
- From: Henrik Goldman
- Hiding symbols in shared library
- Prev by Date: Re: Hiding symbols in shared library
- Next by Date: Re: Hiding symbols in shared library
- Previous by thread: Re: Hiding symbols in shared library
- Next by thread: Re: Hiding symbols in shared library
- Index(es):
Relevant Pages
|