Luke wrote:
> I have a C++ function like this:
> 
> void constraint(double& x, double& dxdt)
> {
>   dxdt[0] = ...
>   dxdt[1] = ...
> ....
>    dxdt[n] = ...
> }
> 
> How would I properly wrap this function in the .pyx file?  And how
> would calling it in Python work?  I've tried to find examples for this
> type of thing but have been unable.  If anybody knows of any, I'd
> greatly appreciate it.

This is C++ syntax candy for passing pointers. You declare and use it in 
Cython like this:

cdef extern from "yourheader.h":
     void constraint(double* x, double* dxdt)

def foo():
     cdef double x = 3.2, dxdt = 0.01
     constraint(&x, &dxdt)

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to