embedding/extending numpy:import_array() problem
Hi guys,
I've a C++ code that calls a python script. The python script, in turn, should
use C modules to retrieve data (arrays).
I'm having some problem with import_array.
I've placed the import_array() just after the initialization of the interpreter
and after PyInit_module
Py_Initialize();
Py_InitModule("py_c_if", PY_C_IF_Methods);
import_array();
This are inside a function called main_PYinit,called within the main C function.
When I tryed to compile, I got the at the line of import_array the error
"function must return a value". If I change the __multiarray_api.h and make
import_array() a function with void instead of #define, the compiltion succeed.
However, when then I try to use some API function I get problems.In particular I
used this code:
char *camera_buffer = cam_data;
npy_int dim[] = {rows,cols}; /* whatever the size of your data, in C-order */
PyObject *myarray;
double *array_buffer;
myarray = PyArray_SimpleNew(2, &dim, NPY_INT);
Py_INCREF(myarray);
array_buffer = (double *)PyArray_DATA(myarray);
for (int i=0; i
participants (1)
-
tino