Hi, first of all, thanks for the replies.
As for the first answer by Lisandro, I do not understand then why my first code fragment at all works... The only difference is that the function called has two params, one instance of one of my classes and a numpy array, while the faulty piece of code should be called on an instance of one of my classes only... As for the second, from Robert, now, very well... how do I specify a value for this implicit parameter then!? It is a bint I guess... I tried to set it to 1 and got new error messages: delay_line.pyx:961:30: Cannot assign type 'tuple (LstFileReader_FAST, int __pyx_skip_dispatch, struct __pyx_opt_args_12delay_line_C_18LstFileReader_FAST_next_ev *__pyx_optional_args)' to 'tuple (*)(LstFileReader_FAST)' I also tried to use cdef in all cases, I get no compile time error but at runtime my object LstFileReader_FAST appears no longer to be defined!? I do not understand because all the calls are made from within Cython code... (so that I expect the cpdef is not really needed) Thanks a lot again for your help! JF On Mon, Apr 20, 2009 at 8:42 PM, Robert Bradshaw <[email protected]> wrote: > On Apr 20, 2009, at 8:17 AM, Jean-Francois Moulin wrote: > >> Hi >> >> I am struggling with a function pointer problem: >> >> cdef class LstFileReader_FAST: >> cdef tuple (*do_read_ev)(LstFileReader_FAST) >> >> def __init__(self,fname): >> >> self.fname = fname >> self.goto_start() >> self.do_read_ev = self._next_ev >> ..... >> >> results in a compilation error: >> >> Cannot assign type 'tuple (LstFileReader_FAST, int >> __pyx_skip_dispatch)' to 'tuple (*)(LstFileReader_FAST)' >> >> I found no clear explanation for this __pyx_skip_dispatch... > > I bet you've declared self._next_ev to be a cpdef (not cdef) > function. cpdef functions have an extra implicit argument > "__pyx_skip_dispatch" which lets them know whether or not they should > skip a possible lookup in the objects dictionary. > > This should probably be a clearer error though... > > - Robert > _______________________________________________ > 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
