[pypy-dev] GSoC proposal - C++ binding

Igor Trindade Oliveira igor_trindade at yahoo.com.br
Tue Mar 24 16:08:28 CET 2009

Hi guys,

i was talking with some pypy guys about work in this summer in GSoC with C++ 
bindings to Pypy and i wrote a proposal and i like that you review it.




Pypy are becoming one of the most used Python interpreter because it is easy 
and flexible, but we still have a big problem, it does not have any binding to 
any Graphical User Interface(GUI) and we have the second problem, many GUIs 
are wrote in C++(like Qt or WxWidgets) and Pypy can not access C++ code 
because it does not have any C API, it just can access C code using ctypes.


Many solutions had been argued but the main solution is use Reflex[2],which is 
developed at CERN (which has an incredible amount of C++ libraries). It is not 
mainly intended for writing Python bindings for C++ libraries but instead 
provides reflection capabilities for C++. The idea is that for every C++ shared 
library, an additional shared library is produced, which allows together with 
Reflex to introspect properties of C++ classes, methods, etc. at runtime. These 
facilities are then used for writing a small generic CPython extension module, 
that allows CPython to use any C++ library for which this reflection 
information was generated [3].
This approach is a bit similar to the ctypes module, apart from the fact that 
ctypes does not use any reflection information, but the user has to specify the 
data structures that occur in the C code herself. This makes it sometimes 
rather burdensome to write cross-platform library bindings.
For PyPy the approach seems rather fitting: We would need to implement only the 
generic extension module(a C language interface to Reflex) and could then use 
any number of C++ libraries.


The main goal of this project is to do a C reflex interface and make an easy 
API using ctypes to RPython communicate with that interface. More specific, the 
goals of the project are:
1.create an interface to reflex in C;
2.Use RPython ctypes to communicate with it;
3.create an API to RPython ctypes have an easy way to communicate with C 
4.Begin a binding to Qt;


The Google Summer of Code is subdivided in two parts. First part plans:
1.work in reflex to create a C interface for it.
2.Begin work on RPython ctypes;

Second part plans:

1.create an API to RPython ctypes communicate with C reflex;
2.Begin Qt binding;


My name is Igor Trindade Oliveira, I am a Undergraduate Computer Engineering 
student in Brazil, in the fourth year.
I work also in KDE project in KDE-PIM projects[1] and have experience with 
microcontrollers like 8051, MSP430, Mips r4000 and Arm 9. 
And with KDE I have very experience with C++ code.

[1] http://techbase.kde.org/Projects/PIM/Akonadi/Testing
[2] http://root.cern.ch/drupal/content/reflex
[3] http://morepypy.blogspot.com/2008/10/sprint-discussions-c-library-

More information about the Pypy-dev mailing list