I am trying to pass a ctype variable to inline c code using scipy.weave.inline. It would seem that it would be simple. The documentation is good at executing the usual types of python objects, however they have a lot more features than I need, and it makes more sense for me to use ctypes when working with C. I am not sure, however, where my error is.
from scipy.weave import inline from ctypes import * def test(): y = c_float()*50 x = pointer(y) code = """ #line 120 "laplace.py" (This is only useful for debugging) int i; for (i=0; i < 50; i++) { x[i] = 1; } """ inline(code, [x], compiler = 'gcc') return y output = test() pi = pointer(output) print pi[0]
source share