Add inline api docs for mono_dll_insert
authorMiguel de Icaza <miguel@gnome.org>
Sat, 21 Apr 2012 01:26:05 +0000 (21:26 -0400)
committerMiguel de Icaza <miguel@gnome.org>
Sat, 21 Apr 2012 01:26:19 +0000 (21:26 -0400)
mono/metadata/loader.c

index 2431465f431deadfe4dc7c09cb77f8d6a7ad0f7d..d69095a6665d2817443b25358ac15a352c1d75eb 100644 (file)
@@ -1180,11 +1180,32 @@ mono_dllmap_lookup (MonoImage *assembly, const char *dll, const char* func, cons
        return mono_dllmap_lookup_list (global_dll_map, dll, func, rdll, rfunc);
 }
 
-/*
+/**
  * mono_dllmap_insert:
+ * @assembly: if NULL, this is a global mapping, otherwise the remapping of the dynamic library will only apply to the specified assembly
+ * @dll: The name of the external library, as it would be found in the DllImport declaration.  If prefixed with 'i:' the matching of the library name is done without case sensitivity
+ * @func: if not null, the mapping will only applied to the named function (the value of EntryPoint)
+ * @tdll: The name of the library to map the specified @dll if it matches.
+ * @tfunc: if func is not NULL, the name of the function that replaces the invocation
  *
  * LOCKING: Acquires the loader lock.
  *
+ * This function is used to programatically add DllImport remapping in either
+ * a specific assembly, or as a global remapping.   This is done by remapping
+ * references in a DllImport attribute from the @dll library name into the @tdll
+ * name.    If the @dll name contains the prefix "i:", the comparison of the 
+ * library name is done without case sensitivity.
+ *
+ * If you pass @func, this is the name of the EntryPoint in a DllImport if specified
+ * or the name of the function as determined by DllImport.    If you pass @func, you
+ * must also pass @tfunc which is the name of the target function to invoke on a match.
+ *
+ * Example:
+ * mono_dllmap_insert (NULL, "i:libdemo.dll", NULL, relocated_demo_path, NULL);
+ *
+ * The above will remap DllImport statments for "libdemo.dll" and "LIBDEMO.DLL" to
+ * the contents of relocated_demo_path for all assemblies in the Mono process.
+ *
  * NOTE: This can be called before the runtime is initialized, for example from
  * mono_config_parse ().
  */