Linking debug C++ DLL with python dlls
"Martin v. Lo"wis"
martin at v.loewis.de
Thu Nov 8 15:31:20 EST 2007
> So I decided to download and build the debug version of python2.5.1/
> As it seems I also need to compile all relevant extension modules
> (*.pyd) in debug as well - is this correct?
That's correct.
> I tried to change the code above (just for fun) so in both cases i'll
> use python25.lib and in debug compilation I got linker errors on
> unresolved externals. seems like the debug version exports more
> methods than the release version.
Correct.
> Is there a way to have my C++ code compile in debug mode (with _DEBUG)
> but use the python25 release lib/dll? This way I don't need to have
> additional set of debug extension modules.
Try removing the definition of Py_DEBUG that is implied by _DEBUG.
Notice, however, that it is risky to mix different CRT versions
(debug and nodebug) in a single application; this could cause memory
leaks and crashes. In particular, it *will* cause crashes if you
pass FILE* opened by the debug CRT to PyRun_File and friends. That's
an inherent limitation of Windows DLLs, and the way Microsoft set
up global variables in the VC CRT.
Regards,
Martin
More information about the Python-list
mailing list