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.

-- 
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.

Reply via email to