I have an array of float values that is created in regular Python, that I want to pass to a cython function that fronts for an underlying C function. The C function requires
I believe you can do this by iterating over the python list of floats and putting them in a C array.
cimport cython
from libc.stdlib cimport malloc, free
cdef:
float * cfloats
int i
cfloats = malloc(len(pyfloats)*cython.sizeof(float))
if cfloats is NULL:
raise MemoryError()
for i in xrange(len(pyfloats)):
cfloats[i] = pyfloats[i]
setOverlays(cfloats)
free(cfloats)