CFFI embedding example.
In this directory, we create a CPython extension module which is itself linked against the PyPy library. From an existing, "large" Python program, we can then use PyPy as a library.
In this demo, we hard-code the function add() with two integer arguments. It is running on top of PyPy, but called from CPython.
The Makefile is made for Arch Linux but should be easy to adapt to other platforms.
$ cd pypy_inside_cpython $ make $ python pyembedding_test.py