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

Yong Sun Yong.Sun at Sun.COM
Fri Apr 18 03:47:19 CEST 2008


Hi, experts,

I am following the tutorial at http://wiki.cython.org/WrappingCPlusPlus, 
and found a minor issue,

cdef class Rectangle:
  - c_Rectangle *thisptr # hold a C++ instance which we're wrapping
  + cdef c_Rectangle *thisptr # hold a C++ instance which we're wrapping

I need the above change to make it successfully compiled by cython. 
While, when I tried to compile it with pyrexc, I met following errors,

$ pyrexc --cplus rect.pyx
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
rect.pyx:18:27: Object of type 'c_Rectangle' has no attribute 'getLength'
rect.pyx:20:27: Object of type 'c_Rectangle' has no attribute 'getHeight'
rect.pyx:22:27: Object of type 'c_Rectangle' has no attribute 'getArea'
rect.pyx:24:20: Object of type 'c_Rectangle' has no attribute 'move'

BTW, I am using the latest stable version,

$ pyrexc --version
Pyrex version 0.9.6.4

Thank you very much!

Regards,



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: rect.pyx
Url: http://lists.copyleft.no/pipermail/pyrex/attachments/20080418/825e66ce/attachment.ksh 


More information about the Pyrex mailing list