[Python-Dev] Need help with C - problem in sqlite3 module

Jeremy Kloth jeremy.kloth at 4suite.org
Sat Sep 23 20:07:29 CEST 2006

On Saturday, September 23, 2006 11:31 am, Gerhard Häring wrote:
> Looks like I don't know C so well after all ...
> Apparently at least gcc on Linux exports all symbols by default that are
> not static. This creates problems with Python extensions that export
> symbols that are also used in other contexts. For example some people use
> Python and the sqlite3 module under Apache, and the sqlite3 module exports
> a symbol cache_init, but cache_init is also used by Apache's mod_cache
> module. Thus there are crashes when using the sqlite3 module that only
> occur in the mod_python context.
> Can somebody with more knowledge about C tell me how to fix the sqlite3
> module or compiler settings for distutils so that this does not happen?
> Of course this only happens because the sqlite3 module is distributed among
> multiple .c files and thus I couldn't make everything "static".

GCC's symbol visibility is supposed to address this exact problem.  It would 
be nice if -fvisibility=hidden was used to build Python (and its extensions) 
by default on supported platforms/compilers.  It shouldn't be much of an 
issue wrt. exported symbols as they already need to be tracked for Windows 
where symbols are hidden by default (unlike traditional *nix).

Jeremy Kloth

More information about the Python-Dev mailing list