exposing #defines in an extension module
Martin von Loewis
loewis at informatik.hu-berlin.de
Tue Sep 25 09:10:27 EDT 2001
Campbell <cb921 at voice.co.za> writes:
> I am trying (without SWIG which is a very nice program) to create an
> extension module working on xxmodule.c from the distribution. All my
> functions are groovy, and now I have several thousand lines of
> #define .... to deal with.
What are these defines? Function-style macros or symbolic numeric
values?
> I've thought of setting them using Object_setattr(), and I've thought
> of just setting them in the .py which will wrap this module. But is
> there any commonly used mechanism to get them in automatically? There
> really is an astonishing (to me) amount of them.
For symbolic numeric values, it is common to expose them on the module
level; recent Python versions add convenience functions for that. See
termios.c for an example.
Regards,
Martin
More information about the Python-list
mailing list