[Cython] Creating python bindings for C library using Cython
Lisandro Dalcin
dalcinl at gmail.com
Mon Jun 1 16:19:11 CEST 2009
On Mon, Jun 1, 2009 at 10:38 AM, Amit Sethi <amit.pureenergy at gmail.com> wrote:
>
> hi ,
> I guess this needs to go on cython-users but i did not see any such mailing
> list so I am posting it here ,
> I am trying to create python bindings for a library written in C ,
> But I am wondering as to how I am suppose to handle pointers.
>
> For example
>
> for the C function,
> int * analyse_row (int length, unsigned char *data),
>
>
> Now in this function call how am i supposed to handle *data , can i pass a
> string in place of *data .
Mmm... better you are sure what the 'data' represent. Anyway, you can
also add explicit cast and call like "analize_row(somelen, <unsigned
char*>somepointer)". I would need some more backgraund from you to
provide a better hint (What is analyse_row() for?)
> Also please guide be to some projects that use
> Cython for binding with C
>
>From my side, you could look at mpi4py, petsc4py, slepc4py (all of
them at Google Code).
--
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
More information about the Cython-dev
mailing list