Skip to content

Commit 53e2d75

Browse files
authored
Update numpy.hpp
1 parent 6121606 commit 53e2d75

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

include/eigenpy/numpy.hpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,25 @@
1111
#define PY_ARRAY_UNIQUE_SYMBOL EIGENPY_ARRAY_API
1212
#endif
1313

14-
// For compatibility with Numpy 2.x
15-
// See
14+
// For compatibility with Numpy 2.x. See:
1615
// https://numpy.org/devdocs/reference/c-api/array.html#c.NPY_API_SYMBOL_ATTRIBUTE
17-
#define NPY_API_SYMBOL_ATTRIBUTE EIGENPY_DLLAPI
16+
#define NPY_API_SYMBOL_ATTRIBUTE
17+
18+
// Numpy headers drags Python with them. As a result, it
19+
// is necessary to include the desired Python library before
20+
// Numpy picks the default one, as it would be impossible to
21+
// to change it afterward. Boost::Python provides a helper
22+
// specifically dedicated to selecting the right Python
23+
// library depending on build type, so let's make use of it.
24+
#include <boost/python/detail/wrap_python.hpp>
1825

1926
#include <numpy/numpyconfig.h>
2027
#ifdef NPY_1_8_API_VERSION
2128
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
2229
#endif
2330

24-
/* Allow compiling against NumPy 1.x and 2.x
25-
see:
26-
https://github.com/numpy/numpy/blob/afea8fd66f6bdbde855f5aff0b4e73eb0213c646/doc/source/reference/c-api/array.rst#L1224
27-
*/
31+
// Allow compiling against NumPy 1.x and 2.x. See:
32+
// https://github.com/numpy/numpy/blob/afea8fd66f6bdbde855f5aff0b4e73eb0213c646/doc/source/reference/c-api/array.rst#L1224
2833
#if NPY_ABI_VERSION < 0x02000000
2934
#define PyArray_DescrProto PyArray_Descr
3035
#endif

0 commit comments

Comments
 (0)