[Mono-dev] embedded runtime questions

Robert Jordan robertj at gmx.net
Sat Sep 10 05:35:27 EDT 2005


Hi,

> 2. Is there a facility to get a MonoMethod* that is more specific  than 
> mono_class_get_method_from_name? This works fine until you have  
> multiple methods with the same name and the same number of arguments.  

You have at least 2 choices:

1.

MonoMethod*
mono_class_get_methods (MonoClass*, gointer* iter);

and build your own signature lookup.

2.

Use the functions from debug-helpers.h

MonoMethodDesc*
mono_method_desc_new (const char *name, gboolean include_namespace);

The format of the name is partially documented
in mono/metadata/debug-helpers.c. It's not documented that
the name may omit the classname, e.g. ":method(int,int)"
but there are a lot of use cases in Mono's source for that.

After you got the MethodDesc you can lookup the method
with:

MonoMethod*
mono_method_desc_search_in_class (MonoMethodDesc *desc,
     MonoClass *klass);

And don't forget to free the desc with

void
mono_method_desc_free (MonoMethodDesc *desc);


Rob




More information about the Mono-devel-list mailing list