Library:Mono
| Developer | Mono project (Xamarin, Microsoft) |
|---|---|
| License | MIT (runtime and class libraries) |
| Website | https://www.mono-project.com |
| On this wiki | Facts · Code · Notes · Topics |
Mono is the open-source .NET runtime (MIT) that Unity, Godot 3 and other engines embed to run C# assemblies; the embedding API (mono_jit_init, mono_domain_assembly_open, mono_runtime_invoke) is exported by mono.dll or mono-2.0-bdwgc.dll.
Identification
- Library names:
mono.dll(old Unity, Mono 2.x),mono-2.0-bdwgc.dll(Mono 4+ with the Boehm GC, Unity MonoBleedingEdge),mono-2.0-sgen.dll(SGen GC),libmono.so,libmonobdwgc-2.0.so,libmonosgen-2.0.so,libmono-2.0.dylib. Unity places them in<Game>_Data/Mono/orMonoBleedingEdge/EmbedRuntime/. - Embedding exports (include/mono/jit/jit.h in the repository, mono/mini/jit.h):
mono_jit_init,mono_jit_init_version,mono_jit_exec,mono_jit_cleanup,mono_jit_set_aot_mode; mono/metadata:mono_get_root_domain,mono_domain_get,mono_domain_assembly_open,mono_assembly_open_full,mono_assembly_load_from,mono_assembly_get_image,mono_assembly_foreach,mono_image_open_from_data,mono_image_open_from_data_with_name,mono_runtime_invoke,mono_runtime_object_init,mono_set_dirs,mono_set_assemblies_path. - Game code is plain .NET: a managed assembly is described in Format:.NET metadata (ECMA-335); names, types and IL survive unless obfuscated.
Unity: Mono versus IL2CPP
See Library:Unity. A Mono build keeps <Game>_Data/Managed/Assembly-CSharp.dll (game scripts), Assembly-CSharp-firstpass.dll (plugins/standard assets), UnityEngine*.dll (engine API wrappers) and the class libraries (mscorlib.dll, System*.dll) in Managed/. An IL2CPP build instead has GameAssembly.dll and global-metadata.dat (Format:IL2CPP global-metadata.dat) and no Assembly-CSharp.dll. Games that load code at run time can keep assemblies in asset bundles or encrypted blobs: look for a hook on mono_image_open_from_data_with_name or mono_assembly_load_from_full, which receives the decrypted image in memory (Unverified: popular for protected Unity games; dump the buffer at that call).
Code & repositories
- https://github.com/mono/mono @
0f53e9e151d92944cacab3e24ac359410c606df6· license: MIT (declared by the contributor for the files used; GitHub reports MIT (read from LICENSE; GitHub's API was busy) for the repository)
Mono runtime source (MIT). Useful without running: mono/mini/jit.h and mono/metadata/{appdomain,assembly,image,object}.h (embedding API).
Tested on: source read, not run: source read, not run · checked 2026-10-18
Pitfalls
- Unity ships its own Mono fork (old Mono 2.x/4.x class library); do not assume a modern runtime. Unity builds its Mono from its own fork (github.com/Unity-Technologies/mono, commit 11e940db4e086fc20c1526dc538d5782d81f8c5f) that adds custom
mono_unity_*functions: mono/metadata/unity-utils.h declares for exampleMONO_API extern void mono_unity_socket_security_enabled_set (gboolean enabled)(line 65) andMONO_API void mono_unity_set_vprintf_func(vprintf_func func)(line 66), so a game's mono.dll can carry exports that upstream Mono lacks. Unverified: the namemono_unity_jit_cleanup; it is not in mono/mini/jit.h or unity-utils.h of that commit, only upstreammono_jit_cleanup(jit.h line 29). mono_runtime_invokeis the usual place to see which managed method the native side calls.
See also
Format:.NET metadata (ECMA-335), Library:Unity.
- Format:Mono AOT image: the AOT output (mono_aot_file_info, flags, tables) used on iOS, Android and WebAssembly.