[Mono-list] Why mono_marshal_get_runtime_invoke() ?

Vivek, Bharath Varma (IE10) Vivek.Varma@honeywell.com
Fri, 4 Jul 2003 09:23:04 -0700


I noticed that there is some dynamic generation of IL wrapper code happening
within the runtime when I run a managed application using mono. 

For the "Main" of my HelloWorld.exe application, this dynamically generated
IL code gets compiled to a function that in turn makes a call to the
runtime's function called "mono_ldftn"(load function token), which
eventually goes on to compile my HelloWorld.exe's "Main". 
If we know the managed application's entry point method("Main") why don't we
compile and call it directly? Why do we create a function which in turn
calls the entry point method? 

I found that this mechanism is used for certain other functions too(some of
which are functions that support opcode emulation). What's basis for
deciding which functions in the runtime will need this dynamic IL wrapper

Any pointers to this please..
Hope the question is clear, if not I guess I'll write a longer email with
more details....