PyArray_BOOL declaration & working with Numpy array of bools in C extension
I have a NumPy array of bools in my code that I wish to write a C extension to. When I try to get a contiguous array in order to use in my C routine, I use:
arr_mask = (PyArrayObject *)
PyArray_ContiguousFromObject(mask, PyArray_BOOL, 2, 2);
But I get the compiler error that PyArray_BOOL is not declared.
xor_masking.c:44:40: error: ‘PyArray_BOOL’ undeclared (first use in this functio开发者_如何学JAVAn)
Why it is so? Is this type undeclared? If it is so, how can I introduce my array of bools to C?
Thanks!
You need to use NPY_BOOL rather than PyArray_BOOL. Also, you will need to be using the numpy header rather than the numeric header if you are still using the numeric header like in one of your other questions.
加载中,请稍侯......
精彩评论