From 352792c90a36ee8d6a520c7602b2dbd03ab19c3f Mon Sep 17 00:00:00 2001 From: Stefan Seefeld Date: Thu, 16 Mar 2017 20:14:39 -0400 Subject: [PATCH] Add more export symbols. --- include/boost/python/numpy/dtype.hpp | 2 +- .../boost/python/numpy/invoke_matching.hpp | 6 +- include/boost/python/numpy/matrix.hpp | 2 +- include/boost/python/numpy/ndarray.hpp | 72 +++++++++++-------- .../python/numpy/numpy_object_mgr_traits.hpp | 4 +- include/boost/python/numpy/scalars.hpp | 2 +- include/boost/python/numpy/ufunc.hpp | 6 +- 7 files changed, 55 insertions(+), 39 deletions(-) diff --git a/include/boost/python/numpy/dtype.hpp b/include/boost/python/numpy/dtype.hpp index 32bb3d4a..9633d37d 100644 --- a/include/boost/python/numpy/dtype.hpp +++ b/include/boost/python/numpy/dtype.hpp @@ -70,7 +70,7 @@ public: }; -bool equivalent(dtype const & a, dtype const & b); +BOOST_NUMPY_DECL bool equivalent(dtype const & a, dtype const & b); namespace detail { diff --git a/include/boost/python/numpy/invoke_matching.hpp b/include/boost/python/numpy/invoke_matching.hpp index 90ec8ae2..095ca3a8 100644 --- a/include/boost/python/numpy/invoke_matching.hpp +++ b/include/boost/python/numpy/invoke_matching.hpp @@ -19,7 +19,7 @@ namespace boost { namespace python { namespace numpy { namespace detail { -struct add_pointer_meta +struct BOOST_NUMPY_DECL add_pointer_meta { template struct apply @@ -29,8 +29,8 @@ struct add_pointer_meta }; -struct dtype_template_match_found {}; -struct nd_template_match_found {}; +struct BOOST_NUMPY_DECL dtype_template_match_found {}; +struct BOOST_NUMPY_DECL nd_template_match_found {}; template struct dtype_template_invoker diff --git a/include/boost/python/numpy/matrix.hpp b/include/boost/python/numpy/matrix.hpp index 43335e1f..829f544a 100644 --- a/include/boost/python/numpy/matrix.hpp +++ b/include/boost/python/numpy/matrix.hpp @@ -61,7 +61,7 @@ public: * return a numpy.matrix instead. */ template -struct BOOST_NUMPY_DECL as_matrix : Base +struct as_matrix : Base { static PyObject * postcall(PyObject *, PyObject * result) { diff --git a/include/boost/python/numpy/ndarray.hpp b/include/boost/python/numpy/ndarray.hpp index 9ad0f20e..e5b6a9e9 100644 --- a/include/boost/python/numpy/ndarray.hpp +++ b/include/boost/python/numpy/ndarray.hpp @@ -142,32 +142,32 @@ public: /** * @brief Construct a new array with the given shape and data type, with data initialized to zero. */ -ndarray zeros(python::tuple const & shape, dtype const & dt); -ndarray zeros(int nd, Py_intptr_t const * shape, dtype const & dt); +BOOST_NUMPY_DECL ndarray zeros(python::tuple const & shape, dtype const & dt); +BOOST_NUMPY_DECL ndarray zeros(int nd, Py_intptr_t const * shape, dtype const & dt); /** * @brief Construct a new array with the given shape and data type, with data left uninitialized. */ -ndarray empty(python::tuple const & shape, dtype const & dt); -ndarray empty(int nd, Py_intptr_t const * shape, dtype const & dt); +BOOST_NUMPY_DECL ndarray empty(python::tuple const & shape, dtype const & dt); +BOOST_NUMPY_DECL ndarray empty(int nd, Py_intptr_t const * shape, dtype const & dt); /** * @brief Construct a new array from an arbitrary Python sequence. * * @todo This does't seem to handle ndarray subtypes the same way that "numpy.array" does in Python. */ -ndarray array(object const & obj); -ndarray array(object const & obj, dtype const & dt); +BOOST_NUMPY_DECL ndarray array(object const & obj); +BOOST_NUMPY_DECL ndarray array(object const & obj, dtype const & dt); namespace detail { -ndarray from_data_impl(void * data, - dtype const & dt, - std::vector const & shape, - std::vector const & strides, - object const & owner, - bool writeable); +BOOST_NUMPY_DECL ndarray from_data_impl(void * data, + dtype const & dt, + std::vector const & shape, + std::vector const & strides, + object const & owner, + bool writeable); template ndarray from_data_impl(void * data, @@ -183,12 +183,12 @@ ndarray from_data_impl(void * data, return from_data_impl(data, dt, shape_, strides_, owner, writeable); } -ndarray from_data_impl(void * data, - dtype const & dt, - object const & shape, - object const & strides, - object const & owner, - bool writeable); +BOOST_NUMPY_DECL ndarray from_data_impl(void * data, + dtype const & dt, + object const & shape, + object const & strides, + object const & owner, + bool writeable); } // namespace boost::python::numpy::detail @@ -250,39 +250,53 @@ inline ndarray from_data(void const * data, * @param[in] nd_max Maximum number of dimensions. * @param[in] flags Bitwise OR of flags specifying additional requirements. */ -ndarray from_object(object const & obj, dtype const & dt, - int nd_min, int nd_max, ndarray::bitflag flags=ndarray::NONE); +BOOST_NUMPY_DECL ndarray from_object(object const & obj, + dtype const & dt, + int nd_min, + int nd_max, + ndarray::bitflag flags=ndarray::NONE); -inline ndarray from_object(object const & obj, dtype const & dt, - int nd, ndarray::bitflag flags=ndarray::NONE) +BOOST_NUMPY_DECL inline ndarray from_object(object const & obj, + dtype const & dt, + int nd, + ndarray::bitflag flags=ndarray::NONE) { return from_object(obj, dt, nd, nd, flags); } -inline ndarray from_object(object const & obj, dtype const & dt, ndarray::bitflag flags=ndarray::NONE) +BOOST_NUMPY_DECL inline ndarray from_object(object const & obj, + dtype const & dt, + ndarray::bitflag flags=ndarray::NONE) { return from_object(obj, dt, 0, 0, flags); } -ndarray from_object(object const & obj, int nd_min, int nd_max, - ndarray::bitflag flags=ndarray::NONE); +BOOST_NUMPY_DECL ndarray from_object(object const & obj, + int nd_min, + int nd_max, + ndarray::bitflag flags=ndarray::NONE); -inline ndarray from_object(object const & obj, int nd, ndarray::bitflag flags=ndarray::NONE) +BOOST_NUMPY_DECL inline ndarray from_object(object const & obj, + int nd, + ndarray::bitflag flags=ndarray::NONE) { return from_object(obj, nd, nd, flags); } -inline ndarray from_object(object const & obj, ndarray::bitflag flags=ndarray::NONE) +BOOST_NUMPY_DECL inline ndarray from_object(object const & obj, + ndarray::bitflag flags=ndarray::NONE) { return from_object(obj, 0, 0, flags); } -inline ndarray::bitflag operator|(ndarray::bitflag a, ndarray::bitflag b) +BOOST_NUMPY_DECL inline ndarray::bitflag operator|(ndarray::bitflag a, + ndarray::bitflag b) { return ndarray::bitflag(int(a) | int(b)); } -inline ndarray::bitflag operator&(ndarray::bitflag a, ndarray::bitflag b) +BOOST_NUMPY_DECL inline ndarray::bitflag operator&(ndarray::bitflag a, + ndarray::bitflag b) { return ndarray::bitflag(int(a) & int(b)); } diff --git a/include/boost/python/numpy/numpy_object_mgr_traits.hpp b/include/boost/python/numpy/numpy_object_mgr_traits.hpp index 8f9f4440..a138f4cd 100644 --- a/include/boost/python/numpy/numpy_object_mgr_traits.hpp +++ b/include/boost/python/numpy/numpy_object_mgr_traits.hpp @@ -7,6 +7,8 @@ #ifndef boost_python_numpy_numpy_object_mgr_traits_hpp_ #define boost_python_numpy_numpy_object_mgr_traits_hpp_ +#include + /** * @brief Macro that specializes object_manager_traits by requiring a * source-file implementation of get_pytype(). @@ -14,7 +16,7 @@ #define NUMPY_OBJECT_MANAGER_TRAITS(manager) \ template <> \ -struct object_manager_traits \ +struct BOOST_NUMPY_DECL object_manager_traits \ { \ BOOST_STATIC_CONSTANT(bool, is_specialized = true); \ static inline python::detail::new_reference adopt(PyObject* x) \ diff --git a/include/boost/python/numpy/scalars.hpp b/include/boost/python/numpy/scalars.hpp index 0ba23c41..c2a83d82 100644 --- a/include/boost/python/numpy/scalars.hpp +++ b/include/boost/python/numpy/scalars.hpp @@ -22,7 +22,7 @@ namespace boost { namespace python { namespace numpy { * * @todo This could have a lot more functionality. */ -class void_ : public object +class BOOST_NUMPY_DECL void_ : public object { static python::detail::new_reference convert(object_cref arg, bool align); public: diff --git a/include/boost/python/numpy/ufunc.hpp b/include/boost/python/numpy/ufunc.hpp index 4c2331c9..7e249238 100644 --- a/include/boost/python/numpy/ufunc.hpp +++ b/include/boost/python/numpy/ufunc.hpp @@ -62,13 +62,13 @@ public: }; /// @brief Construct a multi_iter over a single sequence or scalar object. -multi_iter make_multi_iter(object const & a1); +BOOST_NUMPY_DECL multi_iter make_multi_iter(object const & a1); /// @brief Construct a multi_iter by broadcasting two objects. -multi_iter make_multi_iter(object const & a1, object const & a2); +BOOST_NUMPY_DECL multi_iter make_multi_iter(object const & a1, object const & a2); /// @brief Construct a multi_iter by broadcasting three objects. -multi_iter make_multi_iter(object const & a1, object const & a2, object const & a3); +BOOST_NUMPY_DECL multi_iter make_multi_iter(object const & a1, object const & a2, object const & a3); /** * @brief Helps wrap a C++ functor taking a single scalar argument as a broadcasting ufunc-like