Skip to content

Commit

Permalink
Fix: MSVC Debug Builds
Browse files Browse the repository at this point in the history
  • Loading branch information
skottmckay authored and ax3l committed Mar 7, 2022
1 parent 72390f6 commit 30a79b7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions include/pybind11/pybind11.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@

#pragma once

/* https://github.com/microsoft/onnxruntime/issues/9735#issuecomment-970718821
* The following block patches MSVC debug builds:
* Include Python header, disable linking to pythonX_d.lib on Windows in debug mode.
*/
#if defined(_MSC_VER)
# if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 4)
# define HAVE_ROUND 1
# endif
# include <corecrt.h>
# pragma warning(push)
# pragma warning(disable : 4510 4610 4512 4005)
# if defined(_DEBUG) && !defined(Py_DEBUG)
# define PYBIND11_DEBUG_MARKER
# undef _DEBUG
# endif
#endif

#include "detail/class.h"
#include "detail/init.h"
#include "attr.h"
Expand Down

0 comments on commit 30a79b7

Please sign in to comment.