I am trying to save the state of a cling intepreter, process() a variable amount of code on it, then restore the previous state getting ready for the next chunk of code.
I have been looking into Interpreter::getLastTransaction, Interpreter::getLastestTransaction, Interpreter::getCurrentTransaction (I do not understand the difference between them) and the Interpreter::unload(Transaction &) methods. I discarded Interpreter::unload(unsigned) as I do not know how to count the transactions.
The getXXXTransaction functions all return a const pointer, which is not compatible with the unload function. I tried to remove the const via const_cast, but I ended up with a segfault at runtime.
Thank you for the help!
PS. what about a copy constructor for the Interpreter class? How feasible and fast would that be?
See