[pypy-dev] PyPy, C/C++ and Wrappyr

wlavrijsen at lbl.gov wlavrijsen at lbl.gov
Fri Aug 12 18:10:31 CEST 2011


Hi Vincent,

> * Using Clang to export data from a C/C++ header file to XML (I tried
>   GCCXML, but it would ignore certain things)

several years ago, I did the something similar (more limited) based on gccxml,
so I'm wondering what are the parts that you found ignored by that tool?

An alternative to using clang to produce XML, is to use its PCH directly. This
is the approach taken by cling (a C++ interpreter).

> - Generate a C API to C++ code if necessary.

In cppyy, we keep the generated reflection information available, rather
than wrapping the C++ into C. The advantage of that approach is that the
complex C++ types can than be "unboxed" for the JIT. The disadvantage is,
of course, that it's much more work to deliver and that is taking a long
time, but we're getting there.

> - Generate another XML file describing the Python API (which calls should
>   be made where, etc).

This is like the SWIG .i files? Or am I misunderstanding? An alternative is
to add rules to your XML generator for common mappings (eg. C++ STL iterator
can be mapped on Python's iter protocol).

Best regards,
            Wim
-- 
WLavrijsen at lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net


More information about the pypy-dev mailing list