Embedding python in package using autoconf

Hallvard B Furuseth h.b.furuseth at usit.uio.no
Mon May 15 10:42:13 EDT 2006


I want to use Python as an extension language in a package
which uses autoconf.  That means its and Python's autoconf
#defines can conflict, so I can't safely #include both
<Python.h> and the package's own include files:-(

Do anyone have a safe way to #include at least <object.h>
without <pyconfig.h>?  E.g. copy the files (and <pyport.h>'s
PyAPI_FUNC/PyAPI_DATA) and rename the autoconf macros - and
fail compilation if that wouldn't work?

Currently I have two sets of source files - one set which
only #includes Python.h and one set which only #includes
the package's files.
They communicate through a single .h file with a bunch of
enums for various functions and struct members, and wrapper
functions to use these by their enum value.  It has a few
cheats like declaring "struct _object;" (that's PyObject)
to make life simpler, but it's still rather tedious.

-- 
Hallvard



More information about the Python-list mailing list