3.  Mono Assembly Loader

The mono assembly loader EPluginMono implements a concrete EPlugin type which loads C# assemblies using Mono. Apart from loading the assembly, it can optionally instantiate a class to implement the callback or invoke static methods directly.

3.1. Definition

The mono assembly loader needs the name of the assembly and optionally the name of the class for handling the callbacks.

	    
<e-plugin
  ...
  type="mono"
  location="/full/path/name.dll"
  handler="PluginClass" ?
  ...
  <hook class="...">
   ...
</e-plugin>
type
The type name of a mono assembly plugin is mono.
location
The location parameter contains the full path-name of an assembly to load.
handler

If supplied, the handler contains the fully qualified name of the class which handles all callbacks for this plugin. If a handling class is used, then the function specifications become relative to this class.

This class will be instantiated once upon the first callback invocation, and remain active for the life of the plugin (or application).

3.2. Invocation

Function specification

If no handler class is specified, then the function specification must match a static method in the assembly. This is passed to mono_method_desc_new and mono_method_desc_search_in_image, typically FunctionName(intptr).

If the handler is specified, then the function specification is relative to the handler class. This is passed to mono_method_desc_new and mono_method_desc_search_in_class, typically :MethodName(intptr).

Callback signature

IntPtr function(data);
IntPtr data;

function
The callback method.
data
The hook context data. This is a pointer to unmanaged data, and it is up-to the plugin to interpret this data right now, although some helper binding classes are planned. FIXME: hook-up when they and doco are done.
return value
The callback return data. It is up to the hook's api to define the type of this pointer. It may be a simple boxed value type, or a memory pointer allocated in unmanaged memory (e.g. a GObject handle or a CamelObject cobject value).