Embedding Python in C
Jesse Ibarra <jesse.ibarra.1996 at gmail.com> writes:
> My options seem rather limited, I need to make a Pipeline from (Smalltalk -> C -> Python) then go back (Smalltalk <- C <- Python). Since Smalltalk does not support Python directly I have to settle with the C/Python API (https://docs.python.org/3.6/extending/embedding.html#beyond-very-high-level-embedding-an-overview). Any suggestions?
Decades ago, I implemented something similar
(Chomsky <-> C/C++ <-> Python). Thus, it is possible.
Ensure that you acquire the GIL when you enter the Python world
(almost all Python API function have the implicit precondition
that the GIL is hold); and release it when you leave the
Python world. I forgot whether it was necessary to initialize
Python as a whole (likely, it is).
Maybe, you consider also a looser coupling.
In my scenario above, the various components could be integrated
via CORBA (= "Common Object Request Broker Architecture").