[Mono-list] mono_add_internal_call function overloading
Robert Jordan
robertj at gmx.net
Mon Sep 19 07:43:14 EDT 2011
On 17.09.2011 14:20, Ciunkos wrote:
> Hello, I'm wondering if it is possible to register overloaded function calls
> using mono_add_internal_call. I want to use it so user can call different
> constructors and overloaded methods.
> This code:
> mono_add_internal_call("Namescpace.Vector2::.ctor", Vector2_Constructor);
> mono_add_internal_call(""Namescpace.Vector2::.ctor", Vector2_ConstructorXY);
> mono_add_internal_call(""Namescpace.Vector2::.ctor",
> Vector2_ConstructorValue);
> Causes all constructor calls Vector2_ConstructorValue which is not what I've
> expected.
You can specify overloads with the following syntax:
"Namespace.Vector2::Method(Type1,... TypeN)"
e.g.:
"Namespace.Vector2::Method()"
"Namespace.Vector2::Method(int32)"
"Namespace.Vector2::Method(int32,bool)"
"Namespace.Vector2::Method(Namespace.TypeName)"
Primitive types have a shortcut (see mono/metadata
/icall.c:type_from_typename() in Mono's sources),
while other type must be fully specified.
Robert
More information about the Mono-list
mailing list