[SciPy-User] Share memory between python an C++

David Warde-Farley wardefar@iro.umontreal...
Mon Oct 29 15:01:29 CDT 2012

On Sat, Oct 27, 2012 at 4:29 AM, Gael Varoquaux
<gael.varoquaux@normalesup.org> wrote:

> This file is somewhat lacking an example of passing an array as a pointer
> to C code. This can be done by passing the '.data' attribute of the
> array, that is converted by Cython to a pointer. The following file has
> examples of this:
> https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/svm/liblinear.pyx

Just to add to what Gael said, IIRC the .data attribute on ndarrays
has a somewhat uncertain future in Cython, as memory views obviate the
need for it (is that right?). Anyway, something to keep in mind. You
can always use the PyArray_DATA macro, I think.


More information about the SciPy-User mailing list