how to create an array with boost.python

I want to create python array with boost.python but get segment fault every time. I paste my code as follows. Please give me some hints. Thanks!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <boost/python.hpp>
#include <numpy/ndarrayobject.h>

using namespace boost::python;

int main()
{
	Py_Initialize();
	npy_intp size[] = {4,4};
	PyObject * obj = PyArray_SimpleNew(2, size, NPY_DOUBLE);
	handle<> array(obj);
	numeric::array arr(array);
	Py_Finalize();
}
Topic archived. No new replies allowed.