[pypy-dev] Python FFI

Stefan Behnel stefan_ml at behnel.de
Wed May 16 18:25:28 CEST 2012


wlavrijsen at lbl.gov, 16.05.2012 17:39:
>> Then take a look at some of the tools that Cython users have written to
>> generate .pxd files from header files. I heard of at least two that use
>> gccxml and clang respectively. Seems like Wim Lavrijsen has also started
>> doing the same thing all over again with cppyy.
> 
> not sure where the statement "all over again" comes from, given that the
> tech we use for CPython-bindings pre-dates Cython by half a decade or more.

Hmm, are you sure? Pyrex is pretty old, too. Cython's C++ support certainly
is a lot younger, though. Well, anyway...

My point is that there are too many ways to extract the declarations of a
C/C++ API already and each of them is tied to a specific tool and thus hard
to reuse elsewhere. It would be great to have a common declaration layer
that these tools can generate from the one side and code can use from the
other side.


> Now it's just being re-used and re-implemented for PyPy in a way that fits
> PyPy best.

Ok, my bad then. Get in line with SWIG. ;)


>> I would really appreciate it if there was one way to do this that everyone
>> could just settle on and use, instead of throwing massive amounts of
>> separate developer time on the same issue again and again, that only lead
>> to tools that "work for what the author needed right now".
> 
> That'd be great, but we (HEP) absolutely need C++ in all it's ugly glory,
> and it needs to be fully automatic from the header files. W/o that ability,
> which we do have today for CPython, there would be no Python in HEP. This
> discussion seems to be mostly restricted to C.

I admit that I might have become a bit sloppy about all this "C/C++"
repetition over time. I definitely see C++ in the loop here.

Stefan



More information about the pypy-dev mailing list