[Numpy-discussion] _import_array()

Mads Ipsen madsipsen@gmail....
Tue Feb 14 03:03:23 CST 2012


Hi,

I have C++ module (OpenGL) that extracts data from numpy arrays. The 
interface is pure read-only: It never returns any Python objects but 
only extracts data from numpy arrays. Eg:

#include "numpy/arrayobject.h"

void PrimitiveManager::deleteAtoms(PyObject * numpy_indices)
{
     // Extract number of indices
     int const n = static_cast<int>(PyArray_DIMS(numpy_indices)[0]);
     long * const indices = (long *) PyArray_DATA(numpy_indices);

     // Delete atoms in buffer
     for (int i = 0; i < n; ++i)
     {
         // Do stuff
     }
}

Now, when I compile the code with g++, I get the following warning:

   numpy/core/include/numpy/__multiarray_api.h:1532: warning: 'int 
_import_array()' defined but not used

Do I need to call '_import_array()' somewhere? Am I doing something 
potentially nasty?

Best regards,

Mads





-- 
+-----------------------------------------------------+
| Mads Ipsen                                          |
+----------------------+------------------------------+
| Gåsebæksvej 7, 4. tv |                              |
| DK-2500 Valby        | phone:          +45-29716388 |
| Denmark              | email:  mads.ipsen@gmail.com |
+----------------------+------------------------------+


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120214/40b366f9/attachment.html 


More information about the NumPy-Discussion mailing list