[Pyrex] cimport statement for external C functions

grahamc001uk grahamc001uk at yahoo.co.uk
Mon Feb 19 19:16:50 UTC 2007


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.

If I copy and paste the contents of the interface.pxd file into the .pyx file at the top and comment out the cimport statement then the program compiles OK and runs OK.

I am running on a windows platform (compiling with Microsoft VC7 v13.10.3077).

MyFunction is actually a stub function which just calls another function in a .DLL - buy surely this should make no difference.

















---




		
___________________________________________________________ 
All New Yahoo! Mail – Tired of unwanted email come-ons? Let our SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html



More information about the Pyrex mailing list