[Numpy-discussion] passing a C array to embedded Python from C code

Matthieu Brucher matthieu.brucher at gmail.com
Thu Oct 30 04:08:11 EDT 2008


> Does this approach make sense?  Is there a better way to go about it?
> Maybe calling a custom module from the Python code that does the C
> array to NumPy translation using Cython/pyrex/swig/etc.  Would it be
> possible to use the same C arrays from here without copying them?

Hi,

Your case seems to fit the array interface. The goal is to create a C
structure with some additional information that Numpy can understand,
and then your array will be treated as a Numpy array. If you can
follow a French tutorial, you can go on
http://matthieu-brucher.developpez.com/tutoriels/python/swig-numpy/#LV
to have a skeletton for your issue.

Matthieu
-- 
Information System Engineer, Ph.D.
Website: http://matthieu-brucher.developpez.com/
Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn: http://www.linkedin.com/in/matthieubrucher



More information about the NumPy-Discussion mailing list