cpp_structs.pyx 306 Bytes
Newer Older
Robert Bradshaw's avatar
Robert Bradshaw committed
1 2 3
# tag: cpp
# mode: compile

4 5
from cython.view import array

David Barnett's avatar
David Barnett committed
6 7 8 9 10 11 12 13 14
cdef extern from "point.h" namespace "geometry":

    cdef struct Point:
        double x
        double y
        int color

cdef Point p = Point(0.0, 0.0, 0)
the_point = p
15 16

cdef Point[::1] ps = array((10,), itemsize=sizeof(Point), format='ddi')