> On 25 Oct 2016, at 01:22, Wolfgang Mauer <[email protected]> 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  -  [email protected]
http://lists.dot.net/mailman/listinfo/mono-list

Reply via email to