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

Dietmar Maurer dietmar@ximian.com
Thu, 10 Jul 2003 12:52:52 +0200


> -----Urspr=FCngliche Nachricht-----
> Von: Vivek, Bharath Varma (IE10) [mailto:Vivek.Varma@honeywell.com]=20
> Gesendet: Freitag, 04. Juli 2003 18:23
> An: mono-list@lists.ximian.com
> Cc: miguel@ximian.com
> Betreff: [Mono-list] Why mono_marshal_get_runtime_invoke() ?
>=20
>=20
> Hi,
>=20
> 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
>=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 =
the
wrapper. The genersated wrapper has the following signature:

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

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

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

- Dietmar

>=20
> 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?
>=20
> Any pointers to this please..
> Hope the question is clear, if not I guess I'll write a=20
> longer email with more details....
>=20
> TIA
> Vivek
>=20
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com=20
> http://lists.ximian.com/mailman/listinfo/mono-> list
>=20