On 2014-10-16, Volker Braun <[email protected]> wrote: > Ok, the ctypedef is the wrong thing. Declaring a fake function that is a > cast on the C side is the way to go: > > cdef extern from "foo.h": > int* vla_cast "(int (*)[])" (int*) > int foo(int n, int* a) > > cpdef pyfoo(): > cdef int data[9] > print foo(3, vla_cast(data)) > > Hmm, and what should be in foo.h ? It seems that a C typedef for int (*)[] is not possible. > > > On Thursday, October 16, 2014 10:34:11 PM UTC+1, Dima Pasechnik wrote: >> >> On 2014-10-16, Volker Braun <[email protected] <javascript:>> wrote: >> > On Thursday, October 16, 2014 8:31:20 PM UTC+1, Dima Pasechnik wrote: >> >> >> >> Strange that Cython does not allow a proper cast, to (int (*)[])). >> > >> > >> > Considering that Cython doesn't allow VLAs its probably not surprising. >> > Just make a C macro for the cast. >> >> hmm, I don't know what this means, i.e. I don't know how to tell Cython >> just to leave the thing alone, and plug it into the generated C. >> >> > Or lie to Cython >> > >> > ctypedef int* vlamatrix "(int (*)[])" >> this gives a syntax error in Cython... >> >> > >> > and use that to call f(n, <vlamatrix>a) >> > >> > Now we just need to find whoever came up with (int (*)[])) as syntax for >> > cast to VLA matrix... >> > >> >> >
-- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
