[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Versioned Symbols in Shared Libraries



On Wed, Feb 19, 2003 at 09:36:27AM +1100, Brian May wrote:
> Can somebody please tell me why ugly hacks like the
> following are required?
> 
> +Versions: $(OBJS) 
> +       rm -f $@
> +       echo "DB3_2 {" > $@
> +       echo "  global:" >> $@
> +       nm $(OBJS) | grep " [Tt] " | cut -d" " -f3 | sed -e 's/$$/;/' >> $@
> +       echo "};" >> $@
> 
> Why can't the linker do this automatically?

Sticking this in a version script is likely to do the same thing:

DB3_2 {
      global:
        *;
};

That's about as automatic as you can get.

I'm not really sure why libdb does all that stuff. Anybody?

> I get the impression that the above would make it more painful, for
> instance if some symbols are meant to be local, and not global.

If you want local symbols, you can either kludge stuff directly into
the object file with some whacky gcc magic, or you can write a real
version script. They are not a natural occurance.

-- 
  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ | Dept. of Computing,
 `. `'                          | Imperial College,
   `-             -><-          | London, UK

Attachment: pgp24KFGvirqq.pgp
Description: PGP signature


Reply to: