How is the C# support implemented?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Warlaan
:warning: Old Version Published before Godot 3 was released.

I have been trying to get some simple F# code to run but didn’t succeed in reasonable time, so I have some questions about how the C# support is implemented:

Where is the byte code located that is run? I was expecting that a dll would be created that could be replaced with any other .NET-dll (which is the case in Unity for example), but while Godot does build a dll it doesn’t seem to be used by the runtime. At least I could replace and remove all copies of that dll and it neither affected the game nor did Windows complain that the file was in use.

Is it possible to use .NET-dlls as NativeScript sources? I wouldn’t expect it to be since afaik they aren’t C-ABI compatible, but it has been said that the C#-support was built ontop of GDnative.

And last but not least, is there any technical reason why this is implemented as C#-support rather than .NET- / Mono-support? Yes, I know that C# is by far the most popular .NET-language, but it wouldn’t be very helpful to lock out the other .NET-languages unless there is a reason to do so.

:bust_in_silhouette: Reply From: Calinou

Godot uses Mono to implement C# (Mono 5.2 or higher is required to build the editor with Mono support). The Mono support is implemented as a C++ module, which is not built by default (as it requires Mono to be installed on the system, since the Godot Git repository doesn’t contain the Mono source code as it’s too large).

C# support doesn’t make use of GDNative, which only works with “native” libraries that can be compiled using e.g. C or C++.

To my knowledge, F# was never really tested, and is unlikely to ever be officially supported (even though it may work in the future).

More information about C# support in Godot can be found in this article. You can also take a look at this GitHub issue.