First set of licensing changes
[mono.git] / mono / metadata / domain.c
index a485b71c969cd6ba252371e03a036005e53469dc..da3b6930aafef0036aee4ecf3e6091fbc60dc6ca 100644 (file)
@@ -8,6 +8,7 @@
  * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
  * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
  * Copyright 2011-2012 Xamarin, Inc (http://www.xamarin.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
 #include <config.h>
@@ -267,6 +268,8 @@ mono_install_free_domain_hook (MonoFreeDomainFunc func)
  * @s1: First string to compare
  * @s2: Second string to compare
  *
+ * Compares two `MonoString*` instances ordinally for equality.
+ *
  * Returns FALSE if the strings differ.
  */
 gboolean
@@ -287,6 +290,7 @@ mono_string_equal (MonoString *s1, MonoString *s2)
  * mono_string_hash:
  * @s: the string to hash
  *
+ * Compute the hash for a `MonoString*`
  * Returns the hash for the string.
  */
 guint
@@ -381,6 +385,27 @@ static gsize domain_gc_bitmap [sizeof(MonoDomain)/4/32 + 1];
 static MonoGCDescriptor domain_gc_desc = MONO_GC_DESCRIPTOR_NULL;
 static guint32 domain_shadow_serial = 0L;
 
+/**
+ * mono_domain_create:
+ *
+ * Creates a new application domain, the unmanaged representation
+ * of the actual domain.   Usually you will want to create the
+ *
+ * Application domains provide an isolation facilty for assemblies.   You
+ * can load assemblies and execute code in them that will not be visible
+ * to other application domains.   This is a runtime-based virtualization
+ * technology.
+ *
+ * It is possible to unload domains, which unloads the assemblies and
+ * data that was allocated in that domain.
+ *
+ * When a domain is created a mempool is allocated for domain-specific
+ * structures, along a dedicated code manager to hold code that is
+ * associated with the domain.
+ *
+ * Returns: New initialized MonoDomain, with no configuration or assemblies
+ * loaded into it.
+ */
 MonoDomain *
 mono_domain_create (void)
 {
@@ -600,258 +625,184 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
        }
        mono_defaults.corlib = mono_assembly_get_image (ass);
 
-       mono_defaults.object_class = mono_class_from_name (
+       mono_defaults.object_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Object");
-       g_assert (mono_defaults.object_class != 0);
 
-       mono_defaults.void_class = mono_class_from_name (
+       mono_defaults.void_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Void");
-       g_assert (mono_defaults.void_class != 0);
 
-       mono_defaults.boolean_class = mono_class_from_name (
+       mono_defaults.boolean_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Boolean");
-       g_assert (mono_defaults.boolean_class != 0);
 
-       mono_defaults.byte_class = mono_class_from_name (
+       mono_defaults.byte_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Byte");
-       g_assert (mono_defaults.byte_class != 0);
 
-       mono_defaults.sbyte_class = mono_class_from_name (
+       mono_defaults.sbyte_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "SByte");
-       g_assert (mono_defaults.sbyte_class != 0);
 
-       mono_defaults.int16_class = mono_class_from_name (
+       mono_defaults.int16_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Int16");
-       g_assert (mono_defaults.int16_class != 0);
 
-       mono_defaults.uint16_class = mono_class_from_name (
+       mono_defaults.uint16_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "UInt16");
-       g_assert (mono_defaults.uint16_class != 0);
 
-       mono_defaults.int32_class = mono_class_from_name (
+       mono_defaults.int32_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Int32");
-       g_assert (mono_defaults.int32_class != 0);
 
-       mono_defaults.uint32_class = mono_class_from_name (
+       mono_defaults.uint32_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "UInt32");
-       g_assert (mono_defaults.uint32_class != 0);
 
-       mono_defaults.uint_class = mono_class_from_name (
+       mono_defaults.uint_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "UIntPtr");
-       g_assert (mono_defaults.uint_class != 0);
 
-       mono_defaults.int_class = mono_class_from_name (
+       mono_defaults.int_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "IntPtr");
-       g_assert (mono_defaults.int_class != 0);
 
-       mono_defaults.int64_class = mono_class_from_name (
+       mono_defaults.int64_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Int64");
-       g_assert (mono_defaults.int64_class != 0);
 
-       mono_defaults.uint64_class = mono_class_from_name (
+       mono_defaults.uint64_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "UInt64");
-       g_assert (mono_defaults.uint64_class != 0);
 
-       mono_defaults.single_class = mono_class_from_name (
+       mono_defaults.single_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Single");
-       g_assert (mono_defaults.single_class != 0);
 
-       mono_defaults.double_class = mono_class_from_name (
+       mono_defaults.double_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Double");
-       g_assert (mono_defaults.double_class != 0);
 
-       mono_defaults.char_class = mono_class_from_name (
+       mono_defaults.char_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Char");
-       g_assert (mono_defaults.char_class != 0);
 
-       mono_defaults.string_class = mono_class_from_name (
+       mono_defaults.string_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "String");
-       g_assert (mono_defaults.string_class != 0);
 
-       mono_defaults.enum_class = mono_class_from_name (
+       mono_defaults.enum_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Enum");
-       g_assert (mono_defaults.enum_class != 0);
 
-       mono_defaults.array_class = mono_class_from_name (
+       mono_defaults.array_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Array");
-       g_assert (mono_defaults.array_class != 0);
 
-       mono_defaults.delegate_class = mono_class_from_name (
+       mono_defaults.delegate_class = mono_class_load_from_name (
                mono_defaults.corlib, "System", "Delegate");
-       g_assert (mono_defaults.delegate_class != 0 );
 
-       mono_defaults.multicastdelegate_class = mono_class_from_name (
+       mono_defaults.multicastdelegate_class = mono_class_load_from_name (
                mono_defaults.corlib, "System", "MulticastDelegate");
-       g_assert (mono_defaults.multicastdelegate_class != 0 );
 
-       mono_defaults.asyncresult_class = mono_class_from_name (
+       mono_defaults.asyncresult_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Runtime.Remoting.Messaging", 
                "AsyncResult");
-       g_assert (mono_defaults.asyncresult_class != 0 );
 
-       mono_defaults.manualresetevent_class = mono_class_from_name (
+       mono_defaults.manualresetevent_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Threading", "ManualResetEvent");
-       g_assert (mono_defaults.manualresetevent_class != 0 );
 
-       mono_defaults.typehandle_class = mono_class_from_name (
+       mono_defaults.typehandle_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "RuntimeTypeHandle");
-       g_assert (mono_defaults.typehandle_class != 0);
 
-       mono_defaults.methodhandle_class = mono_class_from_name (
+       mono_defaults.methodhandle_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "RuntimeMethodHandle");
-       g_assert (mono_defaults.methodhandle_class != 0);
 
-       mono_defaults.fieldhandle_class = mono_class_from_name (
+       mono_defaults.fieldhandle_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "RuntimeFieldHandle");
-       g_assert (mono_defaults.fieldhandle_class != 0);
 
-       mono_defaults.systemtype_class = mono_class_from_name (
+       mono_defaults.systemtype_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Type");
-       g_assert (mono_defaults.systemtype_class != 0);
 
-       mono_defaults.monotype_class = mono_class_from_name (
+       mono_defaults.monotype_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "MonoType");
-       g_assert (mono_defaults.monotype_class != 0);
 
-       mono_defaults.runtimetype_class = mono_class_from_name (
+       mono_defaults.runtimetype_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "RuntimeType");
-       g_assert (mono_defaults.runtimetype_class != 0);
 
-       mono_defaults.exception_class = mono_class_from_name (
+       mono_defaults.exception_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "Exception");
-       g_assert (mono_defaults.exception_class != 0);
 
-       mono_defaults.threadabortexception_class = mono_class_from_name (
+       mono_defaults.threadabortexception_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System.Threading", "ThreadAbortException");
-       g_assert (mono_defaults.threadabortexception_class != 0);
 
-       mono_defaults.thread_class = mono_class_from_name (
+       mono_defaults.thread_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System.Threading", "Thread");
-       g_assert (mono_defaults.thread_class != 0);
 
-       mono_defaults.internal_thread_class = mono_class_from_name (
+       mono_defaults.internal_thread_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System.Threading", "InternalThread");
-       if (!mono_defaults.internal_thread_class) {
-               /* This can happen with an old mscorlib */
-               fprintf (stderr, "Corlib too old for this runtime.\n");
-               fprintf (stderr, "Loaded from: %s\n",
-                                mono_defaults.corlib? mono_image_get_filename (mono_defaults.corlib): "unknown");
-               exit (1);
-       }
 
-       mono_defaults.appdomain_class = mono_class_from_name (
+       mono_defaults.appdomain_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System", "AppDomain");
-       g_assert (mono_defaults.appdomain_class != 0);
 
 #ifndef DISABLE_REMOTING
-       mono_defaults.transparent_proxy_class = mono_class_from_name (
+       mono_defaults.transparent_proxy_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System.Runtime.Remoting.Proxies", "TransparentProxy");
-       g_assert (mono_defaults.transparent_proxy_class != 0);
 
-       mono_defaults.real_proxy_class = mono_class_from_name (
+       mono_defaults.real_proxy_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System.Runtime.Remoting.Proxies", "RealProxy");
-       g_assert (mono_defaults.real_proxy_class != 0);
 
-       mono_defaults.marshalbyrefobject_class =  mono_class_from_name (
+       mono_defaults.marshalbyrefobject_class =  mono_class_load_from_name (
                mono_defaults.corlib, "System", "MarshalByRefObject");
-       g_assert (mono_defaults.marshalbyrefobject_class != 0);
 
-       mono_defaults.iremotingtypeinfo_class = mono_class_from_name (
+       mono_defaults.iremotingtypeinfo_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Runtime.Remoting", "IRemotingTypeInfo");
-       g_assert (mono_defaults.iremotingtypeinfo_class != 0);
+
 #endif
 
-       mono_defaults.mono_method_message_class = mono_class_from_name (
+       mono_defaults.mono_method_message_class = mono_class_load_from_name (
                 mono_defaults.corlib, "System.Runtime.Remoting.Messaging", "MonoMethodMessage");
-       g_assert (mono_defaults.mono_method_message_class != 0);
 
-       mono_defaults.field_info_class = mono_class_from_name (
+       mono_defaults.field_info_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Reflection", "FieldInfo");
-       g_assert (mono_defaults.field_info_class != 0);
 
-       mono_defaults.method_info_class = mono_class_from_name (
+       mono_defaults.method_info_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Reflection", "MethodInfo");
-       g_assert (mono_defaults.method_info_class != 0);
 
-       mono_defaults.stringbuilder_class = mono_class_from_name (
+       mono_defaults.stringbuilder_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Text", "StringBuilder");
-       g_assert (mono_defaults.stringbuilder_class != 0);
 
-       mono_defaults.math_class = mono_class_from_name (
+       mono_defaults.math_class = mono_class_load_from_name (
                mono_defaults.corlib, "System", "Math");
-       g_assert (mono_defaults.math_class != 0);
 
-       mono_defaults.stack_frame_class = mono_class_from_name (
+       mono_defaults.stack_frame_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Diagnostics", "StackFrame");
-       g_assert (mono_defaults.stack_frame_class != 0);
 
-       mono_defaults.stack_trace_class = mono_class_from_name (
+       mono_defaults.stack_trace_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Diagnostics", "StackTrace");
-       g_assert (mono_defaults.stack_trace_class != 0);
 
-       mono_defaults.marshal_class = mono_class_from_name (
+       mono_defaults.marshal_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Runtime.InteropServices", "Marshal");
-       g_assert (mono_defaults.marshal_class != 0);
 
-       mono_defaults.typed_reference_class =  mono_class_from_name (
+       mono_defaults.typed_reference_class = mono_class_load_from_name (
                mono_defaults.corlib, "System", "TypedReference");
-       g_assert (mono_defaults.typed_reference_class != 0);
 
-       mono_defaults.argumenthandle_class =  mono_class_from_name (
+       mono_defaults.argumenthandle_class = mono_class_load_from_name (
                mono_defaults.corlib, "System", "RuntimeArgumentHandle");
-       g_assert (mono_defaults.argumenthandle_class != 0);
 
-       mono_defaults.monitor_class =  mono_class_from_name (
+       mono_defaults.monitor_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Threading", "Monitor");
-       g_assert (mono_defaults.monitor_class != 0);
-
-       mono_defaults.runtimesecurityframe_class = mono_class_from_name (
-               mono_defaults.corlib, "System.Security", "RuntimeSecurityFrame");
-
-       mono_defaults.executioncontext_class = mono_class_from_name (
-               mono_defaults.corlib, "System.Threading", "ExecutionContext");
-
-       mono_defaults.internals_visible_class = mono_class_from_name (
-               mono_defaults.corlib, "System.Runtime.CompilerServices", "InternalsVisibleToAttribute");
-
-       mono_defaults.critical_finalizer_object = mono_class_from_name (
-               mono_defaults.corlib, "System.Runtime.ConstrainedExecution", "CriticalFinalizerObject");
-
        /*
-        * mscorlib needs a little help, only now it can load its friends list (after we have
-        * loaded the InternalsVisibleToAttribute), load it now
-        */
+       Not using GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL as this type is heavily checked by sgen when computing finalization.
+       */
+       mono_defaults.critical_finalizer_object = mono_class_try_load_from_name (mono_defaults.corlib,
+                       "System.Runtime.ConstrainedExecution", "CriticalFinalizerObject");
+
        mono_assembly_load_friends (ass);
-       
-       mono_defaults.safehandle_class = mono_class_from_name (
-               mono_defaults.corlib, "System.Runtime.InteropServices", "SafeHandle");
 
-       mono_defaults.handleref_class = mono_class_from_name (
+       mono_defaults.handleref_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Runtime.InteropServices", "HandleRef");
 
-       mono_defaults.attribute_class = mono_class_from_name (
+       mono_defaults.attribute_class = mono_class_load_from_name (
                mono_defaults.corlib, "System", "Attribute");
 
-       mono_defaults.customattribute_data_class = mono_class_from_name (
+       mono_defaults.customattribute_data_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Reflection", "CustomAttributeData");
 
        mono_class_init (mono_defaults.array_class);
-       mono_defaults.generic_nullable_class = mono_class_from_name (
+       mono_defaults.generic_nullable_class = mono_class_load_from_name (
                mono_defaults.corlib, "System", "Nullable`1");
-       mono_defaults.generic_ilist_class = mono_class_from_name (
+       mono_defaults.generic_ilist_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Collections.Generic", "IList`1");
-       mono_defaults.generic_ireadonlylist_class = mono_class_from_name (
+       mono_defaults.generic_ireadonlylist_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Collections.Generic", "IReadOnlyList`1");
 
-       mono_defaults.threadpool_wait_callback_class = mono_class_from_name (
+       mono_defaults.threadpool_wait_callback_class = mono_class_load_from_name (
                mono_defaults.corlib, "System.Threading", "_ThreadPoolWaitCallback");
-       if (!mono_defaults.threadpool_wait_callback_class) {
-               /* This can happen with an old mscorlib */
-               fprintf (stderr, "Corlib too old for this runtime.\n");
-               fprintf (stderr, "Loaded from: %s\n",
-                                mono_defaults.corlib? mono_image_get_filename (mono_defaults.corlib): "unknown");
-               exit (1);
-       }
+
        mono_defaults.threadpool_perform_wait_callback_method = mono_class_get_method_from_name (
                mono_defaults.threadpool_wait_callback_class, "PerformWaitCallback", 0);
 
@@ -867,6 +818,7 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
  * 
  * Creates the initial application domain and initializes the mono_defaults
  * structure.
+ *
  * This function is guaranteed to not run any IL code.
  * The runtime is initialized using the default runtime version.
  *
@@ -935,8 +887,8 @@ mono_cleanup (void)
        mono_loader_cleanup ();
        mono_classes_cleanup ();
        mono_assemblies_cleanup ();
-       mono_images_cleanup ();
        mono_debug_cleanup ();
+       mono_images_cleanup ();
        mono_metadata_cleanup ();
 
        mono_native_tls_free (appdomain_thread_id);
@@ -973,8 +925,11 @@ mono_get_root_domain (void)
 /**
  * mono_domain_get:
  *
- * Returns: the current domain, to obtain the root domain use
- * mono_get_root_domain().
+ * This method returns the value of the current MonoDomain that this thread
+ * and code are running under.   To obtain the root domain use
+ * mono_get_root_domain() API.
+ *
+ * Returns: the current domain
  */
 MonoDomain *
 mono_domain_get ()
@@ -1022,6 +977,16 @@ mono_domain_set_internal (MonoDomain *domain)
        mono_domain_set_internal_with_options (domain, TRUE);
 }
 
+/**
+ * mono_domain_foreach:
+ * @func: function to invoke with the domain data
+ * @user_data: user-defined pointer that is passed to the supplied @func fo reach domain
+ *
+ * Use this method to safely iterate over all the loaded application
+ * domains in the current runtime.   The provided @func is invoked with a
+ * pointer to the MonoDomain and is given the value of the @user_data
+ * parameter which can be used to pass state to your called routine.
+ */
 void
 mono_domain_foreach (MonoDomainFunc func, gpointer user_data)
 {
@@ -1093,6 +1058,15 @@ unregister_vtable_reflection_type (MonoVTable *vtable)
                MONO_GC_UNREGISTER_ROOT_IF_MOVING (vtable->type);
 }
 
+/**
+ * mono_domain_free:
+ * @domain: the domain to release
+ * @force: if true, it allows the root domain to be released (used at shutdown only).
+ *
+ * This releases the resources associated with the specific domain.
+ * This is a low-level function that is invoked by the AppDomain infrastructure
+ * when necessary.
+ */
 void
 mono_domain_free (MonoDomain *domain, gboolean force)
 {
@@ -1528,14 +1502,20 @@ mono_context_set (MonoAppContext * new_context)
        SET_APPCONTEXT (new_context);
 }
 
+/**
+ * mono_context_get:
+ *
+ * Returns: the current Mono Application Context.
+ */
 MonoAppContext * 
 mono_context_get (void)
 {
        return GET_APPCONTEXT ();
 }
 
-/*
+/**
  * mono_context_get_id:
+ * @context: the context to operate on.
  *
  * Context IDs are guaranteed to be unique for the duration of a Mono
  * process; they are never reused.
@@ -1548,8 +1528,9 @@ mono_context_get_id (MonoAppContext *context)
        return context->context_id;
 }
 
-/*
+/**
  * mono_context_get_domain_id:
+ * @context: the context to operate on.
  *
  * Returns: The ID of the domain that @context was created in.
  */
@@ -1591,132 +1572,286 @@ mono_domain_add_class_static_data (MonoDomain *domain, MonoClass *klass, gpointe
        domain->static_data_array [0] = GINT_TO_POINTER (next);
 }
 
+/**
+ * mono_get_corlib:
+ *
+ * Use this function to get the `MonoImage*` for the mscorlib.dll assembly
+ *
+ * Returns: The MonoImage for mscorlib.dll
+ */
 MonoImage*
 mono_get_corlib (void)
 {
        return mono_defaults.corlib;
 }
 
+/**
+ * mono_get_object_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Object`.
+ *
+ * Returns: The `MonoClass*` for the `System.Object` type.
+ */
 MonoClass*
 mono_get_object_class (void)
 {
        return mono_defaults.object_class;
 }
 
+/**
+ * mono_get_byte_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Byte`.
+ *
+ * Returns: The `MonoClass*` for the `System.Byte` type.
+ */
 MonoClass*
 mono_get_byte_class (void)
 {
        return mono_defaults.byte_class;
 }
 
+/**
+ * mono_get_void_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Void`.
+ *
+ * Returns: The `MonoClass*` for the `System.Void` type.
+ */
 MonoClass*
 mono_get_void_class (void)
 {
        return mono_defaults.void_class;
 }
 
+/**
+ * mono_get_boolean_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Boolean`.
+ *
+ * Returns: The `MonoClass*` for the `System.Boolean` type.
+ */
 MonoClass*
 mono_get_boolean_class (void)
 {
        return mono_defaults.boolean_class;
 }
 
+/**
+ * mono_get_sbyte_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.SByte`.
+ *
+ * Returns: The `MonoClass*` for the `System.SByte` type.
+ */
 MonoClass*
 mono_get_sbyte_class (void)
 {
        return mono_defaults.sbyte_class;
 }
 
+/**
+ * mono_get_int16_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Int16`.
+ *
+ * Returns: The `MonoClass*` for the `System.Int16` type.
+ */
 MonoClass*
 mono_get_int16_class (void)
 {
        return mono_defaults.int16_class;
 }
 
+/**
+ * mono_get_uint16_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.UInt16`.
+ *
+ * Returns: The `MonoClass*` for the `System.UInt16` type.
+ */
 MonoClass*
 mono_get_uint16_class (void)
 {
        return mono_defaults.uint16_class;
 }
 
+/**
+ * mono_get_int32_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Int32`.
+ *
+ * Returns: The `MonoClass*` for the `System.Int32` type.
+ */
 MonoClass*
 mono_get_int32_class (void)
 {
        return mono_defaults.int32_class;
 }
 
+/**
+ * mono_get_uint32_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.UInt32`.
+ *
+ * Returns: The `MonoClass*` for the `System.UInt32` type.
+ */
 MonoClass*
 mono_get_uint32_class (void)
 {
        return mono_defaults.uint32_class;
 }
 
+/**
+ * mono_get_intptr_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.IntPtr`.
+ *
+ * Returns: The `MonoClass*` for the `System.IntPtr` type.
+ */
 MonoClass*
 mono_get_intptr_class (void)
 {
        return mono_defaults.int_class;
 }
 
+/**
+ * mono_get_uintptr_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.UIntPtr`.
+ *
+ * Returns: The `MonoClass*` for the `System.UIntPtr` type.
+ */
 MonoClass*
 mono_get_uintptr_class (void)
 {
        return mono_defaults.uint_class;
 }
 
+/**
+ * mono_get_int64_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Int64`.
+ *
+ * Returns: The `MonoClass*` for the `System.Int64` type.
+ */
 MonoClass*
 mono_get_int64_class (void)
 {
        return mono_defaults.int64_class;
 }
 
+/**
+ * mono_get_uint64_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.UInt64`.
+ *
+ * Returns: The `MonoClass*` for the `System.UInt64` type.
+ */
 MonoClass*
 mono_get_uint64_class (void)
 {
        return mono_defaults.uint64_class;
 }
 
+/**
+ * mono_get_single_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Single` (32-bit floating points).
+ *
+ * Returns: The `MonoClass*` for the `System.Single` type.
+ */
 MonoClass*
 mono_get_single_class (void)
 {
        return mono_defaults.single_class;
 }
 
+/**
+ * mono_get_double_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Double` (64-bit floating points).
+ *
+ * Returns: The `MonoClass*` for the `System.Double` type.
+ */
 MonoClass*
 mono_get_double_class (void)
 {
        return mono_defaults.double_class;
 }
 
+/**
+ * mono_get_char_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Char`.
+ *
+ * Returns: The `MonoClass*` for the `System.Char` type.
+ */
 MonoClass*
 mono_get_char_class (void)
 {
        return mono_defaults.char_class;
 }
 
+/**
+ * mono_get_string_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.String`.
+ *
+ * Returns: The `MonoClass*` for the `System.String` type.
+ */
 MonoClass*
 mono_get_string_class (void)
 {
        return mono_defaults.string_class;
 }
 
+/**
+ * mono_get_enum_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Enum`.
+ *
+ * Returns: The `MonoClass*` for the `System.Enum` type.
+ */
 MonoClass*
 mono_get_enum_class (void)
 {
        return mono_defaults.enum_class;
 }
 
+/**
+ * mono_get_array_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Array`.
+ *
+ * Returns: The `MonoClass*` for the `System.Array` type.
+ */
 MonoClass*
 mono_get_array_class (void)
 {
        return mono_defaults.array_class;
 }
 
+/**
+ * mono_get_thread_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Threading.Thread`.
+ *
+ * Returns: The `MonoClass*` for the `System.Threading.Thread` type.
+ */
 MonoClass*
 mono_get_thread_class (void)
 {
        return mono_defaults.thread_class;
 }
 
+/**
+ * mono_get_exception_class:
+ *
+ * Use this function to get the `MonoClass*` that the runtime is using for `System.Exception`.
+ *
+ * Returns: The `MonoClass*` for the `` type.
+ */
 MonoClass*
 mono_get_exception_class (void)
 {