mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 17:02:10 -10:00
upon mdoc.exe for it's operation. * docs/. (svn:ignore), deploy (svn:ignore): Ignore generated files. * docs/AgilityPack.dll, docs/api-style.css, docs/ChangeLog, docs/check, docs/check-coverage, docs/convert.cs, docs/current-api, docs/deploy, docs/documented, docs/exdoc, docs/ignore, docs/mono-api-metadata.html, docs/monoapi.source, docs/produce-lists, docs/public, docs/public-api, docs/README, docs/sources, docs/toc.xml, docs/TODO, docs/wapi: Copy from ../mono/docscripts. * docs/exdoc: Use the in-tree mono program to run convert.exe. * docs/Makefile.am: Mention files to clean/distribute; extract documentation (with exdoc) and then assemble documentation (with monoapi.make's assemble target) for use by monodoc. * docs/monoapi.make: Added; Makefile to use mcs' buid/rules.make to compile convert.cs and assemble documentation. (This is a separate file so that we can include mcs' build/rules.make, which needs topdir set to behave properly BUT must be $(mcs_topdir) from Makefile.am's perspective.) * docs/monoapi.source: Add a /monodoc/node element for use with monodoc 2.2. svn path=/trunk/mono/; revision=117529
79 lines
3.0 KiB
HTML
79 lines
3.0 KiB
HTML
<h2>Embedding Mono</h2>
|
|
|
|
<h4><a name="api:mono_jit_init">mono_jit_init</a></h4>
|
|
<h4><a name="api:mono_set_dirs">mono_set_dirs</a></h4>
|
|
<h4><a name="api:mono_runtime_exec_main">mono_runtime_exec_main</a></h4>
|
|
<h4><a name="api:mono_runtime_exec_managed_code">mono_runtime_exec_managed_code</a></h4>
|
|
|
|
<h4><a name="api:mono_jit_cleanup">mono_jit_cleanup</a></h4>
|
|
<h4><a name="api:mono_set_defaults">mono_set_defaults</a></h4>
|
|
|
|
<h3>Internal Calls</h3>
|
|
|
|
<p>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.
|
|
|
|
<p>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.
|
|
|
|
<p>To register an internal call, use this call you use the
|
|
<tt>mono_add_internal_call</tt> routine.
|
|
|
|
<h4>Data Marshalling</h4>
|
|
|
|
<p>Managed objects are represented as <tt>MonoObject*</tt>
|
|
types. Those objects that the runtime consumes directly have
|
|
more specific C definitions (for example strings are of type
|
|
<tt>MonoString *</tt>, delegates are of type
|
|
<tt>MonoDelegate*</tt> but they are still <tt>MonoObject
|
|
*</tt>s).
|
|
|
|
<p>As of Mono 1.2.x types defined in mscorlib.dll do not have
|
|
their fields reordered in any way. But other libraries might
|
|
have their fields reordered. In these cases, Managed
|
|
structures and objects have the same layout in the C# code as
|
|
they do in the unmanaged world.
|
|
|
|
<p>Structures defined outside corlib must have a specific
|
|
StructLayout definition, and have it set as sequential if you
|
|
plan on accessing these fields directly from C code.
|
|
|
|
<p><b>Important</B> Internal calls do not provide support for
|
|
marshalling structures. This means that any API calls that
|
|
take a structure (excluding the system types like int32,
|
|
int64, etc) must be passed as a pointer, in C# this means
|
|
passing the value as a "ref" or "out" parameter.
|
|
|
|
<h4><a name="api:mono_add_internal_call">mono_add_internal_call</a></h4>
|
|
|
|
<h3>Mono Runtime Configuration</h3>
|
|
|
|
<p>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 <tt>$sysconfig/mono/config</tt>
|
|
(typically this is <tt>/etc/mono/config</tt>).
|
|
|
|
<p>See the <tt>mono-config(5)</tt> man page for more details
|
|
on what goes in this file.
|
|
|
|
<p>The following APIs expose this functionality:
|
|
|
|
<h4><a name="api:mono_config_parse">mono_config_parse</a></h4>
|
|
<h4><a name="api:mono_config_parse_memory">mono_config_parse_memory</a></h4>
|
|
|
|
<h3>Function Pointers</h3>
|
|
|
|
<p>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.
|
|
|
|
<h4><a name="api:mono_create_ftnptr">mono_create_ftnptr</a></h4>
|
|
|