1 Mar 2008 21:20
ctypes callbacks, changing signature
Gabriel Gellner <ggellner <at> uoguelph.ca>
2008-03-01 20:20:55 GMT
2008-03-01 20:20:55 GMT
I am wrapping some ode solvers using ctypes. And I have run into, what I
imagine is, a common problem.
The expected C callback is of the form
void func(int n, double t, double* y, double* yprime);
which I can wrap fine using ctypes. But I would like to be able to use a
python (or f2py generated) function of the normal form
def func(t, y):
# some callculations
return yprime
# instead of
def func(n, t, y, prime):
return None
My question is what do people usually do in this case? Any tips suggestions,
examples.
Thanks a bunch.
Gabriel
RSS Feed