1 <h1>Mono Internals</h1>
3 <p>This section documents some of the internal APIs used
4 inside Mono that developers extending or altering Mono might
9 <h3>Other Encodings</h3>
11 <p>These routines are used when coping with strings that come
12 from Mono's environment, and might be encoded in one or more
13 of the external encodings.
15 <p>For example, some file systems might historically contain a
16 mix of file names with both old and new encodings, typically
17 UTF8 for new files, and the old files would be encoded in an 8
18 bit character set (ISO-8859-1 for example).
20 <p>These routines try a number of encodings, those specified
21 in the <tt>MONO_ENCODINGS</tt> environment variable and return
22 unicode strings that can be used internally.
24 <p>See the mono(1) man page for more details.
26 <h4><a name="api:mono_unicode_from_external">mono_unicode_from_external</a></h4>
27 <h4><a name="api:mono_unicode_to_external">mono_unicode_to_external</a></h4>
28 <h4><a name="api:mono_utf8_from_external">mono_utf8_from_external</a></h4>
30 <h2>Marshalling functions</h2>
32 <h4><a name="api:mono_marshal_alloc">mono_marshal_alloc</a></h4>
33 <h4><a name="api:mono_marshal_asany">mono_marshal_asany</a></h4>
34 <h4><a name="api:mono_marshal_free_array">mono_marshal_free_array</a></h4>
35 <h4><a name="api:mono_marshal_free_asany">mono_marshal_free_asany</a></h4>
36 <h4><a name="api:mono_marshal_free">mono_marshal_free</a></h4>
37 <h4><a name="api:mono_marshal_get_castclass">mono_marshal_get_castclass</a></h4>
38 <h4><a name="api:mono_marshal_get_delegate_begin_invoke">mono_marshal_get_delegate_begin_invoke</a></h4>
39 <h4><a name="api:mono_marshal_get_delegate_end_invoke">mono_marshal_get_delegate_end_invoke</a></h4>
40 <h4><a name="api:mono_marshal_get_delegate_invoke">mono_marshal_get_delegate_invoke</a></h4>
41 <h4><a name="api:mono_marshal_get_icall_wrapper">mono_marshal_get_icall_wrapper</a></h4>
42 <h4><a name="api:mono_marshal_get_isinst">mono_marshal_get_isinst</a></h4>
43 <h4><a name="api:mono_marshal_get_ldfld_remote_wrapper">mono_marshal_get_ldfld_remote_wrapper</a></h4>
44 <h4><a name="api:mono_marshal_get_ldfld_wrapper">mono_marshal_get_ldfld_wrapper</a></h4>
45 <h4><a name="api:mono_marshal_get_managed_wrapper">mono_marshal_get_managed_wrapper</a></h4>
46 <h4><a name="api:mono_marshal_get_native_wrapper">mono_marshal_get_native_wrapper</a></h4>
47 <h4><a name="api:mono_marshal_get_proxy_cancast">mono_marshal_get_proxy_cancast</a></h4>
48 <h4><a name="api:mono_marshal_get_ptr_to_struct">mono_marshal_get_ptr_to_struct</a></h4>
49 <h4><a name="api:mono_marshal_get_remoting_invoke_for_target">mono_marshal_get_remoting_invoke_for_target</a></h4>
50 <h4><a name="api:mono_marshal_get_remoting_invoke">mono_marshal_get_remoting_invoke</a></h4>
51 <h4><a name="api:mono_marshal_get_remoting_invoke_with_check">mono_marshal_get_remoting_invoke_with_check</a></h4>
52 <h4><a name="api:mono_marshal_get_runtime_invoke">mono_marshal_get_runtime_invoke</a></h4>
53 <h4><a name="api:mono_marshal_get_stelemref">mono_marshal_get_stelemref</a></h4>
54 <h4><a name="api:mono_marshal_get_stfld_remote_wrapper">mono_marshal_get_stfld_remote_wrapper</a></h4>
55 <h4><a name="api:mono_marshal_get_stfld_wrapper">mono_marshal_get_stfld_wrapper</a></h4>
56 <h4><a name="api:mono_marshal_get_struct_to_ptr">mono_marshal_get_struct_to_ptr</a></h4>
57 <h4><a name="api:mono_marshal_get_synchronized_wrapper">mono_marshal_get_synchronized_wrapper</a></h4>
58 <h4><a name="api:mono_marshal_get_unbox_wrapper">mono_marshal_get_unbox_wrapper</a></h4>
59 <h4><a name="api:mono_marshal_get_xappdomain_invoke">mono_marshal_get_xappdomain_invoke</a></h4>
60 <h4><a name="api:mono_marshal_load_type_info">mono_marshal_load_type_info</a></h4>
61 <h4><a name="api:mono_marshal_method_from_wrapper">mono_marshal_method_from_wrapper</a></h4>
62 <h4><a name="api:mono_marshal_realloc">mono_marshal_realloc</a></h4>
63 <h4><a name="api:mono_marshal_set_last_error">mono_marshal_set_last_error</a></h4>
64 <h4><a name="api:mono_marshal_type_size">mono_marshal_type_size</a></h4>
66 <h2>Metadata Loading Errors</h2>
68 <p>The routines in this section are used to cope with errors
69 during metadata loading. Errors in metadata handling can
70 happen for many reason, and these include (this is not an
74 <li>An assembly referenced is missing.
75 <li>Fields referenced are missing.
76 <li>Methods referenced are missing.
79 <p>The <tt>mono_loader_set_*</tt> routines are invoked during
80 metadata loading to flag that an error has happened. The
81 class loading errros are flagged in a per-thread basis.
83 <P>In various spots in the runtime the
84 <tt>mono_loader_get_last_error</tt> routine is called to check
85 if there was a problem, and then errors are propagated upwards
86 on the stack until we reach a point where an exception can be
87 raised and no runtime locks are held.
89 <p>The <tt>mono_loader_error_prepare_exception</tt> takes a
90 <tt>MonoLoaderError</tt> structure (the value returned from
91 <tt>mono_loader_get_last_error</tt>), turns that into an
92 exception and clears the error condition from the current
95 <h4><a name="api:mono_loader_set_error_field_load">mono_loader_set_error_field_load</a></h4>
96 <h4><a name="api:mono_loader_set_error_method_load">mono_loader_set_error_method_load</a></h4>
97 <h4><a name="api:mono_loader_set_error_type_load">mono_loader_set_error_type_load</a></h4>
99 <h4><a name="api:mono_loader_get_last_error">mono_loader_get_last_error</a></h4>
100 <h4><a name="api:mono_loader_clear_error">mono_loader_clear_error</a></h4>
101 <h4><a name="api:mono_loader_error_prepare_exception">mono_loader_error_prepare_exception</a></h4>
103 <h2>Metadata Loader Locking: Internals</h2>
105 <p>The locking functions here are used by code in class.c and
106 metadata.c to lock access to the shared hashtables inside the
109 <h4><a name="api:mono_loader_lock">mono_loader_lock</a></h4>
110 <h4><a name="api:mono_loader_unlock">mono_loader_unlock</a></h4>
112 <h2>Garbage Collector Internal Interface</h2>
114 <p>The internal interface of the Mono GC is the interface used
115 between the runtime engine and the garbage collector.
117 <h4><a name="api:mono_gc_disable">mono_gc_disable</a></h4>
118 <h4><a name="api:mono_gc_enable">mono_gc_enable</a></h4>
119 <h4><a name="api:mono_gc_start_world">mono_gc_start_world</a></h4>
120 <h4><a name="api:mono_gc_stop_world">mono_gc_stop_world</a></h4>
121 <h4><a name="api:mono_gc_alloc_fixed">mono_gc_alloc_fixed</a></h4>
122 <h4><a name="api:mono_gc_free_fixed">mono_gc_free_fixed</a></h4>
123 <h4><a name="api:mono_gc_make_descr_from_bitmap">mono_gc_make_descr_from_bitmap</a></h4>
126 <h4><a name="api:mono_gc_base_init">mono_gc_base_init</a></h4>
127 <h4><a name="api:mono_gc_invoke_finalizers">mono_gc_invoke_finalizers</a></h4>
128 <h4><a name="api:mono_gc_is_gc_thread">mono_gc_is_gc_thread</a></h4>
129 <h4><a name="api:mono_gc_pending_finalizers">mono_gc_pending_finalizers</a></h4>
130 <h4><a name="api:mono_gc_register_thread">mono_gc_register_thread</a></h4>
131 <h4><a name="api:mono_gc_finalize_notify">mono_gc_finalize_notify</a></h4>