MUD Game Programmming - Python Modules in C++

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Oct 14 10:13:33 EDT 2009


En Wed, 14 Oct 2009 05:19:06 -0300, Ulrich Eckhardt
<eckhardt at satorlaser.com> escribió:

> Gabriel Genellina wrote:
>>> #ifdef _DEBUG
>>> #undef _DEBUG
>>> #include <Python.h>
>>> #define _DEBUG
>>> #else
>>> #include <Python.h>
>>> #endif
> [...to keep Python from linking against non-existant debug libraries.]
>>
>> No, don't do that. Just compile your application in release mode.
>
> Why not, does it break anything?

You have to ensure the same block is used everywhere <Python.h> is
included, or remember to always use "mypython.h", but there is still the
risk when adding some other external library.
The object layout is different in a debug build, and there are other
incompatible differences. Mixing code compiled in both modes hopefully
would generate a linker error, but if not, it may crash the application.
The debug flag for Python *should* be decoupled from the debug flag for
the application embedding it, but unfortunately it isn't. There is a
feature request at http://bugs.python.org (the site doesn't work for me
now)

-- 
Gabriel Genellina




More information about the Python-list mailing list