On Fri, Oct 17, 2014 at 4:18 AM, Volker Braun <vbraun.n...@gmail.com> wrote:
> On Friday, October 17, 2014 11:02:53 AM UTC+1, Dima Pasechnik wrote: >> >> > cdef extern from "foo.h": >> > int* vla_cast "(int (*)[])" (int*) >> > int foo(int n, int* a) > > Hmm, and what should be in foo.h ? > > > The header of your external C99 code that you want to call. I.e. only the > "foo" function declaration is in the header. > > The vla_cast function is fake, and not in the foo.h header. We tell Cython > that there is a vla_cast and that it takes int* to int*, so Cython thinks > that it is ok to compose foo(3, vla_cast(data)). But in the generated C > file, Cython will write "(int (*)[])" instead of "vla_cast". > > > It seems that a C typedef for int (*)[] is not possible. >> > > Yes, I forgot that the ctypedef also emits the C typedef so we can't use > it just for a Cython typecast. > > cdef extern from *: ctypedef int* int_array_ptr "int (*)[]" That'll work for a cast, but not for a type declaration. - Robert -- 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 sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.