Re: The newbie's question about wrapping c++ class with pyrex

Greg Ewing <[email protected]>
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.