diff --git a/CHANGELOG.md b/CHANGELOG.md index 33ca836e8..f26e678e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Fixed + +- Fix Python library linkage for Debug build on Windows ([#514](https://github.com/stack-of-tasks/eigenpy/pull/514)) + ## [3.10.1] - 2024-10-30 ### Added diff --git a/include/eigenpy/numpy.hpp b/include/eigenpy/numpy.hpp index bf738b32f..f4b7419f1 100644 --- a/include/eigenpy/numpy.hpp +++ b/include/eigenpy/numpy.hpp @@ -11,20 +11,28 @@ #define PY_ARRAY_UNIQUE_SYMBOL EIGENPY_ARRAY_API #endif -// For compatibility with Numpy 2.x -// See +// For compatibility with Numpy 2.x. See: // https://numpy.org/devdocs/reference/c-api/array.html#c.NPY_API_SYMBOL_ATTRIBUTE #define NPY_API_SYMBOL_ATTRIBUTE EIGENPY_DLLAPI +// When building with MSVC, Python headers use some pragma operator to link +// against the Python DLL. +// Unfortunately, it can link against the wrong build type of the library +// leading to some linking issue. +// Boost::Python provides a helper specifically dedicated to selecting the right +// Python library depending on build type, so let's make use of it. +// Numpy headers drags Python with them. As a result, it +// is necessary to include this helper before including Numpy. +// See: https://github.com/stack-of-tasks/eigenpy/pull/514 +#include + #include #ifdef NPY_1_8_API_VERSION #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #endif -/* Allow compiling against NumPy 1.x and 2.x - see: - https://github.com/numpy/numpy/blob/afea8fd66f6bdbde855f5aff0b4e73eb0213c646/doc/source/reference/c-api/array.rst#L1224 -*/ +// Allow compiling against NumPy 1.x and 2.x. See: +// https://github.com/numpy/numpy/blob/afea8fd66f6bdbde855f5aff0b4e73eb0213c646/doc/source/reference/c-api/array.rst#L1224 #if NPY_ABI_VERSION < 0x02000000 #define PyArray_DescrProto PyArray_Descr #endif