Embedding Python in C

mistabean at gmail.com mistabean at gmail.com
Tue Jun 5 03:12:25 EDT 2007


now then... where's the edit button...?

oh well, double-posting. Problem solved, thanks for pointing out that
I am needing a numeric array built instead of building a normal list/
tuple. For those who are curious, steps to solving:

...
#include "libnumarray.h" /*from numpy*/
...
...
...

void CallSnake(...)
{
...
...
Py_Initialize();
import_libnumarray(); /*badgered me to call this one... where i don't
know*/
...
...
pArray = NA_InputArray(pArgs, tFloat32, NUM_C_ARRAY); /*instead of
making a pArg and calling PyList_SetItem(pArg, 0, pArgs); */

/*Check for NULL on pArray*/

pValue = PyObject_CallFunctionObjArgs(pFunc,pArray,NULL);
/*error checking, cleaning up, Finalizing etc etc*/
}




More information about the Python-list mailing list