Integrating a script language into a C++ application

The Python documentation has a page on embedding Python in a C or C++ application.


Why not use Boost.Python? You can expose your data classes to Python and execute a script/function as described here.


If you want to simply run Python scripts from C/C++, then use the Python C API. In your C/C++ code:

PyRun_SimpleString("import math; x = math.sqrt(2 * 2)");

For more complicated things, you will have to look at the API docs, but it's pretty straightforward.