[Cython] [GSoC] Blog post regarding the Cython backend aiming PyPy

On 30 May 2011 23:31, Romain Guillebert <romain.py@gmail.com> wrote:
Cool. Would it be useful to always generate wrapper functions for extern functions with numeric argument types? E.g. this is valid Cython code: cdef extern from "foo.h": ctypedef unsigned int size_t size_t func_with_typedef_arg(size_t a) So here the ctypedef for size_t is unsigned int, which is only valid in C for some platforms/architectures. So perhaps a wrapper function could solve that issue: int __pyx_wrapper_func_with_typedef_arg(int a) { /* some bounds and sign checking code here ? */ return func_with_typedef(a); } Because then you always know that calling it with argtypes = [c_int] and restype = c_int is valid. (BTW, it's also valid to declare something as a function which is actually a macro, so I suppose you always need wrappers for functions.) Do you already have an idea how to handle struct type arguments? Those are often also incomplete... but perhaps I'm geting too far ahead, I don't think we're quite there yet. I suppose you could also place this ABI burden on the user (for now), as does ctypes. As for the linking stuff, perhaps it's a good idea to look at http://wiki.cython.org/enhancements/distutils_preprocessing (currently down unfortunately, but in google cache). Then you can list libraries like this: '# distutils: libraries = spam eggs' at the top of the file. Cheers, Mark
participants (1)
-
mark florisson