Shared library question

Daniel Jacobowitz drow@mvista.com
Wed Jun 19 07:29:00 GMT 2002


On Wed, Jun 19, 2002 at 05:58:06PM +0400, Zagorodnev, Grigory wrote:
> There is a little question about...
> 
> I have a shared library contaning some symbol 'foo'. This symbol has no any
> version defined.
> 
> Is there a way to keep symbol accessible at run-time but hide it at build
> time? 
> So any application previously built with (linked against) that library stay
> workable but any new application will not see this symbol i.e. linker will
> not resolve symbol foo from that library.
> 
> Changing library name is not applicable. Any tricks are wellcome!
> 
> Environment: x86, Red Hat Linux 7.2/7.3

You can still use a version script.  From the Info documentation:

   Node name can be omited, provided it is the only version node in the
version script.  Such version script doesn't assign any versions to
symbols, only selects which symbols will be globally visible out and
which won't.

     { global: foo; bar; local: *; }

I think '{global: *; local: foo; }' will work (but it's a better idea
to explicitly list interfaces that you export).

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer



More information about the Binutils mailing list