[Distutils] Re: limiting symbols in C module
Brandon Craig Rhodes
brandon at rhodesmill.org
Fri Sep 10 13:22:24 CEST 2004
"M.-A. Lemburg" <mal at egenix.com> writes:
> There are probably a few cases where [a Python extension module
> defining hundreds of extra symbols] may cause problems, but in
> general, I don't see why distutils should try to strip symbols from
> C extensions. Is there a specific problem you are trying to solve?
My "problem" is simply that my Python extension defines several
hundred symbols (some of which are not at all specific to its task,
like "range" and "start"), which violates section 1.12 of the
_Extending and Embedding_ document:
... all symbols in extension modules should be declared static,
except for the module's initialization function, in order to avoid
name clashes with other extension modules.
This made me concerned that, unless I took measures to remove the
extraneous symbols, I would be inviting lots of user complaints later
when "range" and "start" and so forth wound up conflicting with
symbols from other parts of Python on certain platforms.
I will happily ignore the issue if the Extending and Embedding
document is being overzealous; but if extraneous symbols are really
not much of a problem, I'm surprised that so many extension modules
are written as single huge .c files.
Brandon Craig Rhodes brandon at rhodesmill.org http://rhodesmill.org/brandon
More information about the Distutils-SIG