[Mono-dev] Registering internal calls at runtime
mboisse at noesisinnovation.net
Tue Jul 13 15:17:32 EDT 2010
Here's the simplest use case which demonstrates our problem. It consists of
two projects (an executable assembly and a dll implemented in C). Here's the
simplest code to reproduce it:
1) Console Application Assembly with Program.cs containing the following
public static class Registrar
public extern static void RegisterMethods();
public class InternallyImplementedClass
public extern static string InternalMethod();
static void Main(string args)
2) A dynamic library containing CInternals.c:
return mono_string_new (mono_domain_get (), "InternalMethod
Registering methods immediately before mono_jit_exec( ) fixes it.
From: "Robert Jordan" <robertj at gmx.net>
Sent: Tuesday, July 13, 2010 7:56 AM
To: <mono-devel-list at lists.ximian.com>
Subject: Re: [Mono-dev] Registering internal calls at runtime
> Hi Michael,
> On 13.07.2010 01:05, Michel Boissé wrote:
>> Thank you Robert, I appreciate your involvement.
>> Here's our problem: any calls to mono_add_internal_call is ineffective
>> made from managed code.
>> Our initial idea was to use P/Invoke to load a dynamic library and run
>> initialization method in it which would make the appropriate
>> Based on tests we did, any call which doesn't precede the mono_jit_exec
>> has no effect.
> I've actually tested this before I've answered your post: adding
> internal calls after the first mono_jit_exec() is supported.
> You can even override existing icalls as long as the affected
> methods were not already JITed.
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
More information about the Mono-devel-list