Hello all,
I'd like to call a Python function from a C++ code. The Python
function has numpy.ndarrays as input.
I figured that the easiest way would be to use ctypes.
However, I can't get numpy and ctypes to work together.
--- run.c
#include Python.h
#include
Check out this thread:
http://www.mail-archive.com/numpy-discuss...@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 --
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.pin...@yale.eduwrote:
Check out this thread: