loading modules in debug

greg.landrum at gmail.com greg.landrum at gmail.com
Tue Jan 31 02:46:39 CET 2006

[I haven't seen an answer for this older question, so I figured I'd go
ahead and post one]

Andras Balogh wrote:
> The problem is that, in debug mode, Python expects every module name to
> be postfixed with _d, which makes my dynamic loading (using LoadLibrary)
> not work, unless I #ifdef it everywhere, and append _d to the dlls
> myself. I could do this, but I don't really like the idea. I'd be happy
> to use the release python interpreter in debug mode too, but the python
> header automatically pulls in the debug version.
> Any ideas/suggestions what could I do?

The easiest way to avoid this behavior on Windows is to replace the
code where you #include <Python.h> with something like this:

#ifdef _DEBUG
#undef _DEBUG
#include <Python.h>
#define _DEBUG
#include <Python.h>

This should cause Python to stop looking for the _d named dlls.


More information about the Python-list mailing list