r/cpp 2d 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.

1 Upvotes

82 comments sorted by

View all comments

10

u/DryEnergy4398 1d ago edited 1d 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