[Mono-dev] Registering internal calls at runtime

Robert Jordan robertj at gmx.net
Sat Dec 30 14:00:16 EST 2006


Argiris Kirtzidis wrote:
>> AFAIK there is no way to do this after the class (or even the assembly?)
>> with the corresponding internal call has been loaded by the runtime.
> 
> Before 'mono_jit_exec' I add an internal call 'do_icall_registration'. In 
> the managed code, If I add the call 'do_icall_registration' to a static 
> class constructor, the registration of new internal calls works fine.
> If I add the call 'do_icall_registration' in the 'Main' method, registration 
> of internal calls don't work.

Add the internal calls before invoking any managed code. Everything
else is just insane.

>>> Also, do internal calls offer significant performance benefits
>>> against P/Invoke ?
>> Yes, because no marshaling will be performed.
> 
> What if no expensive marshalling is required, for example if you have a 
> native function that takes only an integer as a parameter. Are internal 
> calls still faster ?

Not substantial.

Robert

> 
> 
> ----- Original Message ----- 
> From: "Robert Jordan" <robertj at gmx.net>
> To: <mono-devel-list at lists.ximian.com>
> Sent: Saturday, December 30, 2006 9:14 AM
> Subject: Re: [Mono-dev] Registering internal calls at runtime
> 
> 
>> Argiris Kirtzidis wrote:
>>> Hi all,
>>>
>>> I'm using the Mono embedding API, and noticed that if I call
>>> 'mono_add_internal_call' after the managed program started execution
>>> (with 'mono_jit_exec'), the internal call doesn't get registered and
>>> a MissingMethodException is thrown when the managed code tries to
>>> call it.
>>>
>>> Is there a way to register new internal calls after the program
>>> started execution ?
>> AFAIK there is no way to do this after the class (or even the assembly?)
>> with the corresponding internal call has been loaded by the runtime.
>>
>>> Also, do internal calls offer significant performance benefits
>>> against P/Invoke ?
>> Yes, because no marshaling will be performed.
>>
>> Robert
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list 




More information about the Mono-devel-list mailing list