I am getting what I think is a strange seg fault when I am trying to pass boost::numpy::ndarray
as an argument:
#include
#include &
I knew it was something simple. I needed to add these two lines:
Py_Initialize();
boost::numpy::initialize();
as explained : here seg fault results after any attempt to use boost::numpy::ndarray
if the above lines are not ran.
Therefore: my file becomes:
#include <iostream>
#include <boost/python.hpp>
#include <boost/numpy.hpp>
void say_hello(boost::numpy::ndarray& my_array)
//void say_hello(int x) This works fine
{
std::cout<<"Hello"<<std::endl;
}
BOOST_PYTHON_MODULE(hello_ext)
{
using namespace boost::python;
Py_Initialize();
boost::numpy::initialize();
def("say_hello", say_hello);
}