[pypy-dev] offtopic, ontopic, ...

mark florisson markflorisson88 at gmail.com
Tue Feb 14 19:17:13 CET 2012


On 14 February 2012 18:10, Antonio Cuni <anto.cuni at gmail.com> wrote:
> On 02/14/2012 06:56 PM, Stefan Behnel wrote:
>>
>> Ok, then I take it that this would be the preferred Python+FFI approach
>> for
>> interfacing, right? ctypes is out of the loop?
>
>
> note that there are at least two different levels to interface with C code.
>
> The first is using rffi, which lets you to call C code from RPython. Calls
> to rffi functions are translated into C calls at translation time.
>
> Then, there is the ctypes-like approach, which lets you to call C from
> applevel code, which is basically a layer on top of libffi.
> The ctypes approach has some pretty important advantages, e.g. you don't
> need a compiler, people don't need to learn another language, the
> development is faster, etc.

In general, that's nice. For Cython that wouldn't really matter, it is
compiling anyway, might as well add another pass :)

> On the other hand, I think that most of us agree that the ctypes interface
> is terrible. What I would like is an ffi module which is applevel but with a
> much nicer interface. And, the JIT compiler can turn these calls into very
> efficient machine code.
>
> We do need both alternatives in PyPy, if anything because ctypes or this
> yet-to-come "ffi" module need to be implemented in RPython and thus depends
> on rffi.
> However, once it's ready the ffi module should ideally be powerful enough to
> interface with all the C code out there.
>
> ciao,
> Anto
>
> _______________________________________________
> pypy-dev mailing list
> pypy-dev at python.org
> http://mail.python.org/mailman/listinfo/pypy-dev


More information about the pypy-dev mailing list