pymem.h In function '__declspec'

Cathy Reddy creddy92619 at
Tue Mar 8 23:02:47 CET 2005

Thank you very much with your suggestion. I installed the python intepreter from SUSE CD but downloaded the sources of python from the python website. It seems like it created the mismatches here. After I installed the python source rpm from SUSE CD, I was able to pass where I had errors. 

Jeff Epler <jepler at> wrote:What does this command print?
gcc -c -I/usr/Python-2.3.3/Include -x c -o /dev/null \
If it prints an error like the one you included in this message, then
the set of header files in /usr/Python-2.3.3/Include is damaged,
incomplete, or wrong for your compiler environment. If the files in
/usr/Python-2.3.3 are from SUSE, then contact your vendor.

If it doesn't give an error, but the build of your "application RPM"
does, then investigate the compiler defines that are present in the
application that aren't on the above commandline. For instance, I was
able to get errors like yours by using inappropriate compiler
$ gcc -DPy_ENABLE_SHARED -DHAVE_DECLSPEC_DLL -c -x c -o /dev/null \
In file included from /usr/include/python2.3/Python.h:67:
/usr/include/python2.3/pymem.h: In function `__declspec':
/usr/include/python2.3/pymem.h:51: error: syntax error before "__declspec"

You're right that __declspec has something to do with Windows DLLs.
Normally, Python uses the macro 'PyAPI_FUNC' to declare all functions in
its header files. For certain compilers (msvc, cygwin, mingw) it's
appropriate to use the __declspec extension to make the Python shared
library work properly. For other compilers, PyAPI_FUNC doesn't do
anything special. It's through the presence of absence of defines like
Py_ENABLE_SHARED and HAVE_DECLSPEC_DLL that Python decides how to define
PyAPI_FUNC, and this little detail is usually below the radar.


Celebrate Yahoo!'s 10th Birthday! 
 Yahoo! Netrospective: 100 Moments of the Web 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list