[Numpy-discussion] ctypes and numpy
Trevor Clarke
trevor@notcows....
Sat Nov 7 16:07:47 CST 2009
this looks like what I need...I'm not concerned with leaking memory as it's
a borrowed pointer which will be cleaned up in C code later. Thanks for the
pointer.
On Sat, Nov 7, 2009 at 12:36 PM, Zachary Pincus <zachary.pincus@yale.edu>wrote:
> Check out this thread:
>
> http://www.mail-archive.com/numpy-discussion@lists.sourceforge.net/msg01154.html
>
> In shot, it can be done, but it can be tricky to make sure you don't
> leak memory. A better option if possible is to pre-allocate the array
> with numpy and pass that buffer into the C code -- but that's not
> always possible...
>
> Zach
>
>
> On Nov 6, 2009, at 10:18 PM, Chris Colbert wrote:
>
> > Are you bound to using ctypes as the only option?
> >
> > This could be done quite easily in Cython...
> >
> > On Fri, Nov 6, 2009 at 1:57 PM, Trevor Clarke <trevor@notcows.com>
> > wrote:
> >> I've found some info on ctypes and numpy but it mostly tells me how
> >> to pass
> >> numpy objects to C funcs. I've got a C func which returns a
> >> c_void_p to a
> >> buffer and I'd like to access the data using numpy without creating
> >> a copy
> >> of the data. Could someone point me in the right direction?
> >>
> >> _______________________________________________
> >> NumPy-Discussion mailing list
> >> NumPy-Discussion@scipy.org
> >> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >>
> >>
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20091107/830350ff/attachment.html
More information about the NumPy-Discussion
mailing list