I have a library with classes and public methods written in C++.
I would like, from inside an interactive program written in C++ and Qt, to send commands to a parser in Python language which in turn converts them to call to methods and functions of my library.
Something similar to what is done in Octave/Matlab, a string is processed by a parser which then executes internally the commands.
Somewhere in my C++ library I have a function
int myFooCPPfunction(int value)
{
return value*value;
}
then during the execution of my program, I want to start a console and type in Python syntax:
for i in range(0,20):
print("%d" % myFooCPPfunction(i))
The command I gave then updates the internal state of my program for example.
I think it is a matter of writing Python code that links to C++. It seems to me that things like boost::python already do it...I ask your suggestion on which is the better way to write the bindings.
Second point: how to integrate that thing in an interactive shell launched from a Qt application? Some online projects like QConsole should do something similar, but QConsole appears to be a very outdated project.
Thank you!