VC++-Extension in Debug-Mode

Greg Landrum glandrum at my-deja.com
Tue Nov 21 16:06:42 CET 2000


In article <8vdh9k$509$1 at nnrp1.deja.com>,
  sentinel101 at my-deja.com wrote:
> I've problems with an extension written in VC++ and compiled & linked
in
> Debug mode. I got the debug libs from the BeOpen-Website and
everything
> 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
module
> named XXX". The crash seems to happen in Python20_d.dll
(modsupport.c),
> 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
unhappiness.

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).

-greg


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list