如何从单声道的c ++中获取某个类中所有方法的列表?

时间:2014-09-07 13:12:35

标签: c# c++ mono

我加载了我的程序集" monoass.dll"使用

mono_domain_assembly_open(domain, "C:/monoass.dll");

然后我发现我的班级名称是" MainClass"使用

mono_class_from_name(mono_assembly_get_image(ass), "monoass", "MainClass"); // where "monoass" is the name of namespace

然后我需要在" MainClass"中找到所有方法 class为MonoMethod**数组。我怎么能这样做?

单声道版本为:Mono-3.2.3

其他问题:

1)如何将MonoMethod的名称,参数和返回值输出到控制台?有没有mono_method_to_string(MonoMethod *方法)函数?

2)如何在程序集中获取所有名称空间(并将每个名称打印到控制台),然后为每个名称空间获取名称空间中所有clases的数组?

1 个答案:

答案 0 :(得分:1)

您可以获得所有这样的方法:

void* iter = NULL;
MonoMethod* method;
while(method = mono_class_get_methods(mono_class, &iter))
{
    cout << mono_method_full_name(method, 1);
}