[Pyrex] cimport statement for external C functions

Stefan Behnel stefan_ml at behnel.de
Mon Feb 19 19:31:33 UTC 2007



grahamc001uk wrote:
> Has anybody successfully used the cimport statement for defining external C functions ?
> 
> If I put the following in file interface.pxd:
> cdef extern from "interface.h":
>     void MyFunction ()
> 
> and the following in my .pyx file:
> cimport interface
> 
> with a call to MyFunction () later in the code.
> 
> The program compiles OK but I get the run time error:
> NameError: MyFunction 
> when I run it.

Try calling "interface.MyFunction()" or "from interface cimport MyFunction".

Regards,
Stefan




More information about the Pyrex mailing list