I just bumped into Cling and I wanted to congratulate you guys, this is some great work!
I literally just build cling and obviously I’m a complete newbee but I did run into some issues and I was hoping to get some questions down as well.
Firstly, it appears .U does not work (at least on OSX 10.9) with the latest git repo. I built cling from source and had a very simple Test.cpp, which loads fine in cling and executes its function just fine. However, when I try to unload it via .U I get the following assertion hit:
Hello World[cling]$ .U Test.cpp
Assertion failed: (Pos != Map->end() && “no lookup entry for decl”), function removeDecl, file /Users/lasti/Documents/Source/cling/src/tools/clang/lib/AST/DeclBase.cpp, line 1162.
Abort trap: 6
after which cling just exits. The Test.cpp is completely trivial:
#include
void Test()
{
printf(“Hello World”);
}
So, I’m not sure if this is a known bug or?..
My other question is, I see how people have already integrated cling into their application and the interpreter can be embedded to provide ‘interactive’ C++ from within an app. This is already awesome! However, I’m not clear if it is possible, and how would one go about, completing the circle and actually re-linking the newly compiled symbols into the running binary?
Let me try to explain what I mean: Say you have a program main(), which has an object Foo in Foo.cpp. Foo is compiled and linked in and used in your program. Is it then possible to use cling to change Foo.cpp at runtime and have that object/symbol relinked into the program dynamically? If so, what would be the approach to take?
Thanks so much, and again, great work!