I'm trying to follow:
http://wiki.cython.org/WrappingCPlusPlus
What am I doing wrong?
===== Rectangle.h
class Rectangle {
public:
int x0, y0, x1, y1;
Rectangle(int x0, int y0, int x1, int y1);
~Rectangle();
int getLength();
int getHeight();
int getArea();
void move(int dx, int dy);
};
===== rectangle.pyx
cdef extern from "Rectangle.h":
ctypedef struct c_Rectangle "Rectangle":
int x0, y0, x1, y1
int (*getLength)()
int (*getHeight)()
int (*getArea)()
void (*move)(int dx, int dy)
c_Rectangle *new_Rectangle "new Rectangle" (int x0, int y0, int x1, int y1)
void del_Rectagle "delete" (c_Rectangle *rect)
cdef class Rectangle:
c_Rectangle *thisptr # hold a C++ instance which we're wrapping
def __cinit__(self, int x0, int y0, int x1, int y1):
self.thisptr = new_Rectangle(x0, y0, x1, y1)
def __dealloc__(self):
del_Rectangle(self.thisptr)
def getLength(self):
return self.thisptr.getLength()
def getHeight(self):
return self.thisptr.getHeight()
def getArea(self):
return self.thisptr.getArea()
def move(self, dx, dy):
self.thisptr.move(dx, dy)
=========
cython rectangle.pyx
Error converting Pyrex file to C:
------------------------------------------------------------
...
void (*move)(int dx, int dy)
c_Rectangle *new_Rectangle "new Rectangle" (int x0, int y0, int x1, int y1)
void del_Rectagle "delete" (c_Rectangle *rect)
cdef class Rectangle:
c_Rectangle *thisptr # hold a C++ instance which we're wrapping
^
------------------------------------------------------------
/home/nbecker/cython/rectangle.pyx:12:16: 'c_Rectangle' is not a constant,
variable or function identifier
... more errors...
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev