[Mono-list] mono/embedded

Wolfgang Mauer wolfgang.mauer at kabelmail.de
Tue Oct 25 10:10:57 UTC 2016


Thx a lot!
That is what I'm looking for :-)

Wolfgang

-----Ursprüngliche Nachricht-----
Von: Mono-list [mailto:mono-list-bounces at lists.xamarin.com] Im Auftrag von Jonathan Mitchell
Gesendet: Dienstag, 25. Oktober 2016 11:46
An: Mono-list at lists.ximian.com
Betreff: Re: [Mono-list] mono/embedded


> 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
_______________________________________________
Mono-list maillist  -  Mono-list at lists.dot.net http://lists.dot.net/mailman/listinfo/mono-list




More information about the Mono-list mailing list