[Mono-list] mono/embedded
Jonathan Mitchell
lists at mugginsoft.com
Tue Oct 25 09:46:24 UTC 2016
> On 25 Oct 2016, at 01:22, Wolfgang Mauer <wolfgang.mauer at kabelmail.de> wrote:
>
> Hi,
> do everyone know if there is something like “AppDomain.CurrentDomain.AssemblyResolve” in embedded Mono?
> Thanks
>
If you actually want to respond to the AssemblyResolve event then use an internal call.
The basic procedure is:
Define a static managed event handler function like so.
Register this as a handler for AssemblyResolve.
namespace MyStuff.EventHelper
{
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern Assembly AssemblyResolved(object sender, ResolveEventArgs args);
}
When it fires it will call a native static function.
Register the function like so.
mono_add_internal_call ("MyStuff.EventHelper: AssemblyResolved", &myStaticNativeFunction);
static MonoAssembly * myStaticNativeFunction(MonoObject* monoSender, MonoObject* monoResolveEventArgs) {
MonoAssembly *assembly = nil;
// use mono_runtime_invoke to query monoResolveEventArgs
return assembly.
}
Have you taken a look at https://github.com/robert-j/Mono.Embedding?
This provides a C++ thunk based code generator.
Jonathan
More information about the Mono-list
mailing list