C
C#15mo ago
Ashy

❔ need help loading in runtime

I want to be able to load c# projects as “internal libraries” in my language during runtime so that I can have multiple built in internal functions and stuff so then I can build the standard libraries in the Lang and I have no clue if I can load c# projects in runtime like that
10 Replies
Thinker
Thinker15mo ago
in my language
You're making a language?
Ashy
Ashy15mo ago
indeed
Thinker
Thinker15mo ago
You can compile to IL which would allow you to interop with C# practically flawlessly
Ashy
Ashy15mo ago
alright thanks!
Thinker
Thinker15mo ago
also cute pfp
Ashy
Ashy15mo ago
Thanks you too!
Thinker
Thinker15mo ago
The relevant namespace would be System.Reflection.Metadata which allows you to emit IL code. Note that this is very low-level, but I assume you're prepared for that if you're making a language. https://learn.microsoft.com/en-us/dotnet/api/system.reflection.metadata?view=net-8.0
System.Reflection.Metadata Namespace
Provides low-level functionality for reading assembly metadata according to ECMA-335. This namespace is designed to be used by compilers and other tools that need to read assembly metadata.
Thinker
Thinker15mo ago
You can output this into a DLL and then load it from C# or vice versa, or even run it using the .NET CLI.
Ashy
Ashy15mo ago
Thank you!
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.