[Mono-dev] Registering internal calls at runtime

Robert Jordan robertj at gmx.net
Mon Jul 12 17:35:52 EDT 2010

On 12.07.2010 21:43, MBoisse wrote:
> Has there been any improvements regarding late registrations of internal
> methods at runtime using "mono_add_internal_call"?
> Would it make sense to load and register C functions in a dll from managed
> code, and only then have the assembly referring to them loaded?
> There are many scenarios in which the C functions we need to make calls to
> aren't known at compile time of the embedding unmanaged code (ie mono.exe)
> and therefore registrations can't be made before the call to mono_jit_exec
> is made. However, most often the functions are known at the managed code
> compile time.
> Is P/Invoke still our only option?

You could add an internal call that adds internal calls ;) Problem solved.

Or resort to an internal p/invoke from the runtime itself:

static extern void mono_add_internal_call(string desc, IntPtr ftnptr);


More information about the Mono-devel-list mailing list