Embedding Mono

mono_jit_init

mono_set_dirs

mono_runtime_exec_main

mono_runtime_exec_managed_code

mono_jit_cleanup

mono_set_defaults

Internal Calls

The Mono runtime provides two mechanisms to expose C code to the CIL universe: internal calls and native C code. Internal calls are tightly integrated with the runtime, and have the least overhead, as they use the same data types that the runtime uses.

The other option is to use the Platform Invoke (P/Invoke) to call C code from the CIL universe, using the standard P/Invoke mechanisms.

To register an internal call, use this call you use the mono_add_internal_call routine.

mono_add_internal_call

Mono Runtime Configuration

Certain features of the Mono runtime, like DLL mapping, are available through a configuration file that is loaded at runtime. The default Mono implementation loads the configuration file from $sysconfig/mono/config (typically this is /etc/mono/config).

See the mono-config(5) man page for more details on what goes in this file.

The following APIs expose this functionality:

mono_config_parse

mono_config_parse_memory

Function Pointers

To wrap a function pointer into something that the Mono runtime can consume, you should use the mono_create_ftnptr. This is only important if you plan on running on the IA64 architecture. Otherwise you can just use the function pointer address.

mono_create_ftnptr