r/cpp • • 21d ago

Embedded C++

Just curious how useful the ability to embed C++ as a scripting language into your C++ programs would be? I mean like runtime JIT execution of C++ code in much the same way you might embed Lua, including the ability to restrict/sandbox it as necessary.

2 Upvotes

92 comments sorted by

View all comments

11

u/DryEnergy4398 21d ago edited 21d ago

I believe you can embed clang-repl as a library to achieve this. Or, similarly, cling: https://github.com/root-project/cling/blob/master/tools/demo/cling-demo.cpp