VC++-Extension in Debug-Mode

Greg Landrum glandrum at
Tue Nov 21 16:06:42 CET 2000

In article <8vdh9k$509$1 at>,
  sentinel101 at wrote:
> I've problems with an extension written in VC++ and compiled & linked
> Debug mode. I got the debug libs from the BeOpen-Website and
> seemed to work fine until I imported the module.
> The standard Python interpreter just crashed immediately after
displaying the
> message "Fatal Python error: Interpreter not initialized (version
> mismatch?)". The debug version of Python simply says "ImportError: No
> named XXX". The crash seems to happen in Python20_d.dll
> probably in function Py_InitModule4TraceRefs. Can I circumvent this by
> undefining Py_TRACE_REFS which I found in modsupport.h ? Any idea ?

The simplest explanation for this is that you have forgotten to append
an _d to the name of your debug extension dll, i.e. your mod.dll should
be called mod_d.dll when you build in Debug mode. Under Windows, you
have to do this.  When you are running the debug version of python,
it can't find mod_d.dll so you get an error.  When you are running
the "normal" version of python, which uses python20.dll, you get
mod.dll imported, but it comes along with python20_d.dll.  The net
result of having different versions of the same dll imported is

The real fun starts if you use a number of other extension modules and
you need to make sure that you have up-to-date, accessible versions of
all of them in both Release and Debug forms.

Welcome to Windows Debug Hell (TM).


Sent via
Before you buy.

More information about the Python-list mailing list