In section 1.12 of Extending and Embedding the Python
Interpreter Release 2.4, the example (spammodule) does
not compile on linux with distutils. I get the following:
~/sandbox/python/c_api_test$ python2.4 spam-setup.py build
running build
running build_ext
building 'spam' extension
creating build
creating build/temp.linux-i686-2.4
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes -fPIC -I/usr/include/python2.4 -c
spammodule.c -o build/temp.linux-i686-2.4/spammodule.o
spammodule.c:7: error: conflicting types for
`PySpam_System'
spammodule.h:21: error: previous declaration of
`PySpam_System'
error: command 'gcc' failed with exit status 1
I think the solution is to change line 12 of the
spammodule header file listing from:
#define PySpam_System_PROTO (char *command)
to:
#define PySpam_System_PROTO (const char *command)
as that seems to compile for me. (though not tested
from another C extension).
|