[pypy-dev] Embedding pypy

Michael Hudson micahel at gmail.com
Sun Apr 22 11:57:40 CEST 2007


On 22/04/07, Lalo Martins <lalo.martins at gmail.com> wrote:
> Here's an interesting question...
>
> how hard would it be to write a C API for embedding the pypy VM in a C or C+
> + application?  I have an application for which I'm working on Python
> scripting, but for many reasons it would be interesting to use pypy instead.

Well, to do it at all would require attacking a small pile of details:
teaching the tool chain to build a library rather than an application,
supporting multiple entry points (though I guess this bit is somewhat
solved by the extcompiler and the js backend, in different ways), ...
nothing too impossible though.

The fun part would be the integration between the application and the
interpreter.  If you're happy with just passing strings back and forth
(equivalent to Py_RunSimpleString or whatever it's called) that's
probably quite easy, but also not very interesting.  To provide
app-specific modules to Python, to allow Python to call your app which
then calls Python again... I dunno, but this sort of thing would
probably be quite a lot of work.

Cheers,
mwh



More information about the Pypy-dev mailing list