Re: Hiding symbols in shared library



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

.



Relevant Pages

  • Re: text file saved in COM format..
    ... But Windoze ... A more sophisticated operating system won't bother doing file ... Linux is ready for the desktop! ... Maybe a bit of a hassle for the newbie, but that's what keeps the user space ...
    (microsoft.public.windowsxp.general)
  • Re: Getting people into Linux
    ... it also seems to me that no other operating system has put ... If Linux wants to take a real run at other OS es, ... I have had the opportunity to teach 3 or 4 people how to use computers ... primarily marketing companies that spend a great deal of money making ...
    (Fedora)
  • Re: lost install CD while playing freesbee
    ... > love my computer and its operating system". ... > to communicate in any way. ... worshipped in its prehistorical form by every Linux fanatic. ... > use a PERL script than start VI. ...
    (alt.linux)
  • Muckrosoft in Shambles, AVOID Vista and 7, CHOOSE - Macintosh or LInux - the time is NOW.
    ... Microsoft's internal disorganziation, shoddy operating system software ... Macintosh and Linux are. ... A NOTE on the "Bill and Melinda Gates Foundation and their ... the "City of Lights" in the third world, where oil fires are burning ...
    (alt.politics)
  • Re: Is there a messenger service out there?
    ... >>Of course they can call it an operating system. ... >>support for every digital camera out there, ... but Linux is free. ... Linux does have support for webcams, it even has support for my ...
    (alt.linux)

Quantcast