AW: [Mono-list] Why mono_marshal_get_runtime_invoke() ?

Dietmar Maurer
Thu, 10 Jul 2003 12:52:52 +0200

> -----Urspr=FCngliche Nachricht-----
> Von: Vivek, Bharath Varma (IE10) []=20
> Gesendet: Freitag, 04. Juli 2003 18:23
> An:
> Cc:
> Betreff: [Mono-list] Why mono_marshal_get_runtime_invoke() ?
> Hi,
> I noticed that there is some dynamic generation of IL wrapper=20
> code happening within the runtime when I run a managed=20
> application using mono.=20
> For the "Main" of my HelloWorld.exe application, this=20
> dynamically generated IL code gets compiled to a function=20
> that in turn makes a call to the runtime's function called=20
> "mono_ldftn"(load function token), which eventually goes on=20
> to compile my HelloWorld.exe's "Main".=20
> If we know the managed application's entry point=20
> method("Main") why don't we compile and call it directly? Why=20
> do we create a function which in turn calls the entry point method?=20

For example we need to support exceptions, and this is also handled in =
wrapper. The genersated wrapper has the following signature:

MonoObject *runtime_invoke (MonoObject *this, void **params, MonoObject

So this is a way to call managed function with different signatures, =
an single API.

For more information take a look at mono/mono/metadata/marshal.c

- Dietmar

> I found that this mechanism is used for certain other=20
> functions too(some of which are functions that support opcode=20
> emulation). What's basis for deciding which functions in the=20
> runtime will need this dynamic IL wrapper mechanism?
> Any pointers to this please..
> Hope the question is clear, if not I guess I'll write a=20
> longer email with more details....
> Vivek
> _______________________________________________
> Mono-list maillist  -
>> list