How can I create a NumPy array which is backed by ctypes data? ie create a NumPy array from a ctypes one without any data copying?
So that changing an element of the NumPy array will alter the underlying ctypes array. I have C structures that contain numerical data and would like to access that data through the NumPy array interface. I have tried the following: PyObject *make_dbl_array(double *data, int n) { npy_intp dim = n; return PyArray_SimpleNewFromData(1, &dim, NPY_DOUBLE, (void *)data); } But when called via ctypes (with restype set to ctypes.py_object) it gives a bus error. Andrew _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion