Use Python library from C++

Pierre Barbier de Reuille pierre.barbier at cirad.fr
Thu Nov 25 05:46:31 EST 2004


Chang LI a écrit :
> I want to use the Python Libray from my C++ program.
> The Python Libray is no GUI. How can I mix C++ and 
> Python? 
> 
> One way is to run PY library as an independent process.
> Another way is to start PY as a C++ thread. 
> The third way is to run Python engine as part of the C++. 
> Which way is better?
> 
> No intention to access all the Python's code but only 
> access APIs of a module.

If you just want to access the Python API (or some APIs of modules) you 
need to launch the interpreter (in the current thread will be ok) and 
then you can access everything ... import modules, create objects, etc.

Pierre



More information about the Python-list mailing list