Am 05.03.2010 15:09, schrieb Lisandro Dalcin:

On 4 March 2010 19:45, Greg Ewing <[email protected]>
<[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. Should the callback demo be changed?

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

Reply via email to