Skip to content

Commit 30a79b7

Browse files
skottmckayax3l
authored andcommitted
Fix: MSVC Debug Builds
1 parent 72390f6 commit 30a79b7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

include/pybind11/pybind11.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@
1010

1111
#pragma once
1212

13+
/* https://github.com/microsoft/onnxruntime/issues/9735#issuecomment-970718821
14+
* The following block patches MSVC debug builds:
15+
* Include Python header, disable linking to pythonX_d.lib on Windows in debug mode.
16+
*/
17+
#if defined(_MSC_VER)
18+
# if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 4)
19+
# define HAVE_ROUND 1
20+
# endif
21+
# include <corecrt.h>
22+
# pragma warning(push)
23+
# pragma warning(disable : 4510 4610 4512 4005)
24+
# if defined(_DEBUG) && !defined(Py_DEBUG)
25+
# define PYBIND11_DEBUG_MARKER
26+
# undef _DEBUG
27+
# endif
28+
#endif
29+
1330
#include "detail/class.h"
1431
#include "detail/init.h"
1532
#include "attr.h"

0 commit comments

Comments
 (0)