Hi,

I am using cython to wrap some fairly large C API, with a big numbers
of enumerations. Those API are big enough so that I got tired of
manually declaring the definitions (in particular enum), and start
working on a code generator based on gccxml. It almost works for some
non trivial headers (CoreAudio framework, Alsa headers), but I have a
problem with the following kind of C declaration:

typedef struct foo foo_t;

struct foo {
    foo_t *foo;
}

AFAIK, cython does support typedefing a struct directly, and you
should use something like that instead:

cdef struct foo:
    foo_t *foo
ctypdef foo foo_t

Which does not work as the recursive reference uses the typedef'd type
name. The following works, though:

cdef struct foo:
    foo *foo
ctypdef foo foo_t

For now, I can get away by modifying on the fly the gccxml parsed tree
when I detect a recursive reference, but this feels hackish. Is there
a better way ?

David
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to