Skip to content

Commit 8a50eaa

Browse files
John Starkjcfr
authored andcommitted
[commontk] Fix VS2010 compilation issue when PythonQt Debug build against python Release
* Copied most of the contents of vtkPython.h to dPython.h
1 parent 5d2c9b6 commit 8a50eaa

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/PythonQtPythonInclude.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,42 @@
5656
# include <math.h>
5757
# endif
5858

59+
//
60+
// Use the real python debugging library if it is provided.
61+
// Otherwise use the "documented" trick involving checking for _DEBUG
62+
// and undefined that symbol while we include Python headers.
63+
// Update: this method does not fool Microsoft Visual C++ 8 anymore; two
64+
// of its header files (crtdefs.h and use_ansi.h) check if _DEBUG was set
65+
// or not, and set flags accordingly (_CRT_MANIFEST_RETAIL,
66+
// _CRT_MANIFEST_DEBUG, _CRT_MANIFEST_INCONSISTENT). The next time the
67+
// check is performed in the same compilation unit, and the flags are found,
68+
// and error is triggered. Let's prevent that by setting _CRT_NOFORCE_MANIFEST.
69+
//
70+
5971
// If PYTHONQT_USE_RELEASE_PYTHON_FALLBACK is enabled, try to link
6072
// release Python DLL if it is available by undefining _DEBUG while
6173
// including Python.h
6274
#if defined(PYTHONQT_USE_RELEASE_PYTHON_FALLBACK) && defined(_DEBUG)
6375
#undef _DEBUG
76+
// Include these low level headers before undefing _DEBUG. Otherwise when doing
77+
// a debug build against a release build of python the compiler will end up
78+
// including these low level headers without DEBUG enabled, causing it to try
79+
// and link release versions of this low level C api.
80+
# include <basetsd.h>
81+
# include <assert.h>
82+
# include <ctype.h>
83+
# include <errno.h>
84+
# include <io.h>
85+
# include <math.h>
86+
# include <sal.h>
87+
# include <stdarg.h>
88+
# include <stddef.h>
89+
# include <stdio.h>
90+
# include <stdlib.h>
91+
# include <string.h>
92+
# include <sys/stat.h>
93+
# include <time.h>
94+
# include <wchar.h>
6495
#if defined(_MSC_VER) && _MSC_VER >= 1400
6596
#define _CRT_NOFORCE_MANIFEST 1
6697
#define _STL_NOFORCE_MANIFEST 1

0 commit comments

Comments
 (0)