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

Library packages that export too many symbols

There are quite a bunch of libraries in the archive that export more
symbols than they should, including all their private functions. I've
been made aware of such a problem in SDL_mixer, and took the time to
search for a solution.

Maybe everyone here already knows the problem and its solution, but I
can't remember hearing of it, and I guess it cannot hurt to remind
library packages maintainers to have a look at their objdump output, to
check whether they are in this case. Indeed, I found the solution is
rather trivial if the package uses libtool.

For example, it took one line in SDL_Mixer's Makefile.am:
        libSDL_mixer_la_LDFLAGS = -export-symbols-regex Mix_.*

And voilà. Only the public symbols, which for SDL_Mixer are called
Mix_FooBar are exported, and the private symbols remain private.

This is simple and avoids quite some namespace problems. I suppose it
also improves dynamic linking performance by reducing the symbol table
 .''`.           Josselin Mouette        /\./\
: :' :           josselin.mouette@ens-lyon.org
`. `'                        joss@debian.org
  `-  Debian GNU/Linux -- The power of freedom

Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=

Reply to: