Problems compiling python Debug under windows

Marco Gillies m.gillies at ucl.ac.uk
Wed Feb 27 16:35:16 CET 2002


I'm having a bit of a nightmare trying to write a python extension in
C++ under windows. I traced the original problem to the fact that I
should be using the debug version of python with a debug extension. So
I'm trying to compile python as debug. Which is where the problems
start.

I've got as far as compiling the pythoncore module (the python dll and
executables). However, I also need to compile the external modules,
_sre, _socket, parser etc. I've compiled these and the .pyd files are
there and I've tried to import them into python the give an error:

Import Error:dynamic modules does not define init function

I've tried to run DUMPBIN on the .pyd file to see what names it
exports and it doesn't seem to export anything. I think this is
because USE_DL_EXPORT isn't defined. I tried defining this but then
the modules won't compile. They give various external symbol
unresolved errors of the form:

socketmodule.obj : error LNK2001: unresolved external symbol
_PyExc_TypeError
socketmodule.obj : error LNK2001: unresolved external symbol
_PyTuple_Type

etc. etc.

My suspition is that, as USE_DL_EXPORT defines both DL_EXPORT and
DL_IMPORT to be __declspec(dllexport) some symbols in header files
that are being imported by the module I'm compiling are defined as
DL_IMPORT and should be import symbols but are in fact being defined
as export symbols by the DL_IMPORT macro.

I guess I'm doing something wrong, probably I'm defining USE_DL_EXPORT
in the wrong place (I'm doing it in the Visual C++ properties dialog
which defines the symbol on the command line while compiling the
module). I'm using Visual C++ .NET.

Does anyone have any ideas 

thanks 

Marco



More information about the Python-list mailing list