On Wed, Jun 3, 2009 at 8:09 AM, Jon Olav Vik <[email protected]> wrote:
>
> Somewhere inside pysundials.cvode.NVector is an array of double
> screaming to get out [6]. However, Dag Sverre told me that passing it
> to Cython may require converting between ctypes and Cython pointers.

if you have a 'ctypes' object , you can use ctypes.addressof() to get
a integer (ctypes uses PyLong_FromVoidPtr()) containing the underlying
pointer. Next, in Cython code you can use core Python C-API call
PyLong_AsVoidPtr() to get the C-side pointer.

Of course, if your odefun() is tiny, this will not alleviate the
overhead of the Python layer.


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to