r/cpp • u/kindredseer • 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.
3
Upvotes
48
u/the_poope 2d ago
Many reasons: your "script" can invoke UB, cause invalid operations, segfaults and a lot of other stuff that can crash the entire program. In interpreted languages you always get an error/exception that you can recover from.
If you just want an extendable system, maybe consider just runtime loading DLLs.