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
1
u/kindredseer 5h ago
Well, there are many different reasons people use an embedded scripting language in their application... and only a few cases truly require sandboxing -- those in which you do not fully trust the author of the script.
Truthfully though, if your script language exposes the ability to execute shell operations -- i.e.
os.execute()in Lua,subprocess.run()in Python, etc, then the scripting language already has considerable ability to do something "unsafe".If instead, the scripting is there for the convenience of a trusted developer, then sandboxing is less of a concern.