I am trying to wrap a header file which has lots of functions like this
test.h
void test(int N, int* data_in, int* data_out);
so that I can use those from numpy.
Right now I have the following cython code:
test.pyx
import numpy as np
cimport numpy as np
ctypedef np.int_t itype_t
cdef extern from 'VolumeForm.h':
void _test 'test' (int, int*, int*)
def wrap_test(np.ndarray[itype_t, ndim=2] data):
cdef np.ndarray[dtype_t, ndim=1] out
out = np.zeros((data.shape[0],1), dtype=np.double)
_test(
data.shape[0],
<itype_t*> data.data,
<itype_t*> out.data
)
return out
However, when I try to compile it I get the error:
Error converting Pyrex file to C:
(...)
Cannot assign type 'test.itype_t *' to 'int *'
How can I fix this?