Some platforms like Durango or iOS do not allow the usage of JIT.
Is there a way to use Mono embedded in a native game engine without JIT (full AOT)?
For example, I have a dotnet 4.0 DLL with gameplay logic. I am using Mono JIT engine to execute some methods of it. Can I do the same thing with a native prebuilt AOT PE/ELF while keeping my native code separate from the AOT executable?
Thank you in advance!
What is Durango?
Yes, Mono is suited for platforms that doesn't allow JIT compilation. Xamarin.iOS is an active user for example, and we do have a template how to build Mono for that platform:
https://github.com/mono/mono/tree/master/sdks
We also have an interpreter that could be used instead of FullAOT, but this is only recommended if your application is not performance sensitive or if you want to dynamically generate .NET IL code.
Durango is a code name for Xbox One.
So, as far as I understand, I load an assembly with normal JIT engine but I set up an AOT data load hook with mono_install_load_aot_data_hook that loads an .aotdata file with AOT code.
But how do I create this file? Is this simply a renamed output of --aot (dynamic library with an assembly) or something different?
We also have an interpreter that could be used instead of FullAOT, but this is only recommended if your application is not performance sensitive or if you want to dynamically generate .NET IL code.
How to configure the Mono runtime to use interpreter when embeded in application?
@GCCFeli it depends on what target, but I'm assuming you are asking for AOT-only platforms. Follow the code around isinterp:
https://github.com/mono/mono/blob/db626fe9d370fb1f431667ae31a370b70275ef2b/sdks/ios/appbuilder/appbuilder.cs#L15-L76
Also, when AOT compiling assemblies, use --aot=interp. (Yes, you'll still need the AOT compiler to generate some trampolines and wrappers).
The man page is also worth checking out.