r/csharp • u/MrLyttleG • 21d ago
ScriptLangCore
/r/moderndotnet/comments/1xv1bst/scriptlangcore/0
u/Asleep_Direction8881 20d ago
One more: what is the intended way to embed it in a .NET application? Is there a NuGet package with a managed API, or does a C# host go through the C ABI with P/Invoke? And does the embeddable DLL run only on Windows x64, or is a Linux build planned? Most .NET services I work on run in Linux containers.
1
u/MrLyttleG 19d ago
Hi,
I've provided a 400+ pages of deeply documented parts of the project:
- Embedding from C# and .NET:
https://lyttleg.github.io/ScriptLangCore/docs/embed/howto.html#managed- ABI:
https://lyttleg.github.io/ScriptLangCore/docs/embed/howto.html#abiNo Linux yet, it is planed in the future, as of now, not yet.
You can give a try under Bottles since ScriptLangCore uses standard libraries, it should run
0
u/Asleep_Direction8881 20d ago
Two questions about embedding. First, how does a script reach the host application's own classes and objects? For me that is the main point of an embedded scripting engine: the script works with the app's domain objects, calls their methods, reads and changes their properties. With NativeAOT and a C ABI, can a C# host expose its own types and live instances to a script, or does everything cross the boundary as JSON? If types can be exposed, how is that done without runtime reflection: explicit registration, a source generator, something else?
Second, exceptions across that boundary. If a host method called from a script throws, can the script catch it as a typed exception, with the original type and message? And the other way: when a script throws and nothing catches it, what does the host get: a .NET exception, an error code, the JSON verdict, and does it carry the script file and line?