bug-gnulib
[Top][All Lists]
Advanced

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

Re: [libvirt] namespace clean shared libraries


From: Bruno Haible
Subject: Re: [libvirt] namespace clean shared libraries
Date: Sun, 08 Jul 2012 19:51:22 +0200
User-agent: KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; )

Daniel P. Berrange wrote:
> If its better to just do it in libvirt config.h, then we
> can do that too

Yes, doing '#define foo libvirt_foo' in config.h is the preferred way
of achieving a namespace clean shared library.

There are two ways to generate these #defines:

1) You collect manually, on various systems, the set of symbols that you
   don't want to clash with symbols from other shared libraries. You need
   to do this on various systems, because gnulib may define functions
   'rpl_fflush' or 'dprintf' on some systems and not on others.

2) You collect, from a set of header files, the set of symbols that you
   want to have exported, and process all other symbols with
     '#define foo libvirt_foo'

   This approach is more robust, but requires to compile all *.o files
   twice: Once with the initial settings (no #define), and once for real.

   This approach is implemented in libunistring. Look at the config.h rule
   in this Makefile.am [1]. There are two auxiliary scripts: 'declared.sh' [2]
   extracts the symbols from a .h file (assuming a particular coding style).
   'exported.sh' [3] extracts te symbols of a .o file.

Bruno

[1] 
http://git.savannah.gnu.org/gitweb/?p=libunistring.git;a=blob;f=lib/Makefile.am
[2] 
http://git.savannah.gnu.org/gitweb/?p=libunistring.git;a=blob;f=lib/declared.sh
[3] 
http://git.savannah.gnu.org/gitweb/?p=libunistring.git;a=blob;f=lib/exported.sh.in




reply via email to

[Prev in Thread] Current Thread [Next in Thread]