C
C#2y ago
Ashley

❔ 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
Thinker2y ago
in my language
You're making a language?
Ashley
AshleyOP2y ago
indeed
Thinker
Thinker2y ago
You can compile to IL which would allow you to interop with C# practically flawlessly
Ashley
AshleyOP2y ago
alright thanks!
Thinker
Thinker2y ago
also cute pfp
Ashley
AshleyOP2y ago
Thanks you too!
Thinker
Thinker2y 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
Thinker2y 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.
Ashley
AshleyOP2y ago
Thank you!
Accord
Accord2y 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.

Did you find this page helpful?