[SciPy-dev] ctypes callbacks, changing signature
Robert Kern
robert.kern@gmail....
Sat Mar 1 14:26:52 CST 2008
On Sat, Mar 1, 2008 at 2:20 PM, Gabriel Gellner <ggellner@uoguelph.ca> wrote:
> 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.
Wrap it with a function of the required signature.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the Scipy-dev
mailing list