Problems compiling python Debug under windows

Mark Hammond mhammond at skippinet.com.au
Thu Feb 28 01:49:49 CET 2002


Marco Gillies wrote:
> 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

You should just open the workspace in MSVC, select the Debug 
configuration, and build it.

I assume this works, and you are left with _sre_d.pyd, _socket_d.pyd etc 
in your PCBuild directory?

Then, start python_d, and attempt to import your module.

Assuming that all works, then we are left with a configuration issue in 
your specific project.  (If it doesn't work, post as many details about 
this specific problem - eg, a directory listing of PCBuild\*_d.pyd, and 
a Python prompt that prints sys.path then attempts to import _sre.)

For your projects, don't touch USE_DL_EXPORT - just set DEBUG and 
_DEBUG, then #include "Python.h".  It should then "just work" ;)

Mark.




More information about the Python-list mailing list