[Mono-list] RE: mono_marshal_get_runtime_invoke (marshal.c)

bvv bvv" <bvvarma1@rediffmail.com
19 Aug 2003 12:59:12 -0000


On 08/18/2003 Derek Woo wrote:
>>I am trying to understand what this method does in mono 
>>(marshal.c):
>>MonoMethod *
>>mono_marshal_get_runtime_invoke (MonoMethod *method)
>>It looks like it generate a method (in the form of IL) which 
>>wraps >>around the "Main" method of a program. Am I getting the 
>>meaning? >>Could someone elaborate a little bit on that?

Yes, you are right! The method generates IL wrapper for your 
"Main".
There are 3 main reasons for this,
1. Handling exceptions - The generated method has a filter 
exception clause, so that C code can intercept exceptions.
2. Handling calling convention differences - The calling 
convention of managed methods may be different from that of 
functions in the C, and this IL wrapper does the appropriate 
conversions.
3. Single API to call managed methods - The IL wrapper has the 
following signature - MonoObject *runtime_invoke (MonoObject 
*this, void **params, MonoObject **exc)
Using this API you can effectively call any managed method 
whatever its signature.

-Vivek

___________________________________________________
Meet your old school or college friends from
1 Million + database...
Click here to reunite www.batchmates.com/rediff.asp