[Pyrex] The newbie's question about wrapping c++ class with pyrex

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Apr 19 01:22:56 CEST 2008


Yong Sun wrote:

> rect.pyx:4:21: Non-extern C function declared but not defined
> rect.pyx:5:21: Non-extern C function declared but not defined
> rect.pyx:6:19: Non-extern C function declared but not defined
> rect.pyx:7:17: Non-extern C function declared but not defined

You need to declare these members as function pointers, i.e.

   cdef extern from "Rectangle.h":
     ctypedef struct c_Rectangle "Rectangle":
       ...
       int (*getLength)()
       int (*getHeight)()
       int (*getArea)()

The error message you get in this case is a bit confusing.
I'll see if I can improve it in a future release.

-- 
Greg



More information about the Pyrex mailing list