On 5 March 2010 13:16, Gregor Thalhammer <[email protected]> wrote: > Am 05.03.2010 15:09, schrieb Lisandro Dalcin: > > On 4 March 2010 19:45, Greg Ewing <[email protected]> wrote: > > > Gregor Thalhammer wrote: > > > > cdef extern from "cheesefinder.h": > ctypedef void myvoid > ctypedef myvoid (__stdcall *cheesefunc)(char *name, void *user_data) > #this g > ives 'Syntax error in ctypedef statement' > > > Seems to be a Cython-only problem, as this compiles > okay with Pyrex 0.9.8.6. > > > > Indeed. IIRC, Robert changed the parser in order to support other > things, and then some function typedefs stop working. > > Gregor: I would declare things like things: > > ctypedef myvoid __stdcall cheesefunc(char *name, void *user_data) > > void find_cheeses(cheesefunc* user_func, void *user_data) > > > > Thanks for this advice. I tried and found that even > > ctypedef myvoid __stdcall cheesefunc(char *name, void *user_data) > void find_cheeses(cheesefunc user_func, void *user_data) > > works, it compiles to the same C code. I like this version since it is a) > more ease to write and b) matches better the definition of find_cheeses in > the header file.
Are you sure this definition do actually matches he header file? IANAL regarding C, but a function type is not the same that a function pointer type, despite the fact that in some cases the function and function pointers seems to be/behave the same... > > Should the callback demo be changed? > Let's wait for Robert's comments... Perhaps your original problem is indeed a bug, and we should fix it. -- Lisandro Dalcin --------------- 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
