Thanks Lisandro, I may just end up declaring each struct like this with a 'pass'
and then implementing the fields on the python side (this is how ctypes does it) Cheers! On Wed, Jul 1, 2009 at 3:01 PM, Lisandro Dalcin<[email protected]> wrote: > On Wed, Jul 1, 2009 at 3:24 PM, Chris Colbert<[email protected]> wrote: >> i just saw this line in the docs: >> >> 6. If the header file defines a function using a macro, declare it as >> though it were an ordinary function, with appropriate argument and >> result types. >> >> So i'll start there. >> >> Sorry for the bogus post. >> > > IMHO, your post was not bogus... Making Cython use such kind of macros > (which resembles a C++ template emulation) can be not so easy... > Perhaps the easiest way would be to define a helper struct (one of > each node_type) in some C header, and then include it using cdef > extern from "mydefs.h": ... > > >> >> On Wed, Jul 1, 2009 at 1:52 PM, Chris Colbert<[email protected]> wrote: >>> In wrapping a C library, I come across many #define statements that I >>> need to use elsewhere. When they simply define a constant, I use an >>> anonymous enum and all is well. >>> >>> But how would I wrap something like this that shown up in a header >>> file that i'm cdef extern'ing from: >>> >>> #define CV_TREE_NODE_FIELDS(node_type) \ >>> >>> int flags; \ >>> >>> int header_size; \ >>> >>> struct node_type* h_prev; \ >>> >>> struct node_type* h_next; \ >>> >>> struct node_type* v_prev; \ >>> >>> struct node_type* v_next ; >>> >>> >>> or something like this: >>> >>> #define CV_IS_STORAGE(storage) \ >>> >>> ((storage) != NULL && \ >>> >>> (((CvMemStorage*)(storage))->signature & CV_MAGIC_MASK) == >>> CV_STORAGE_MAGIC_VAL) >>> >>> >>> >>> >>> Thanks and Cheers! >>> >>> Chris >>> >> _______________________________________________ >> Cython-dev mailing list >> [email protected] >> http://codespeak.net/mailman/listinfo/cython-dev >> > > > > -- > Lisandro Dalcín > --------------- > Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) > Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) > Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) > PTLC - Güemes 3450, (3000) Santa Fe, Argentina > Tel/Fax: +54-(0)342-451.1594 > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev > _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
