I'm using C # to script through the Mono project with C ++ . I'm trying to fetch a list of all the classes contained in a DLL made in a C # project (which is a Class Library project). But I'm not finding a solution. I'm researching the documentation but the documentation is horrible.
I've been searching a lot but nothing for a solution .... Below an example of classes contained in DLL .
using System;
namespace Nodes
{
public class BaseNode
{
public string m_Name = "Unamed";
public string m_Description = "None";
public int m_Id = -1;
public void SetName(string newName) { m_Name = newName; }
public string GetName() { return m_Name; }
public void SetDescription(string newDescription) { m_Description = newDescription; }
public string GetDescription() { return m_Description; }
public void SetId(int newId) { m_Id = newId; }
public int GetId() { return m_Id; }
}
}
And the code that is incomplete.
mono_set_dirs("C:\Program Files\Mono\lib", "C:\Program Files\Mono\etc");
mono_config_parse(nullptr);
MonoDomain* domain = mono_init_version("MonoApplycation", "v4.0.30319");
MonoAssembly* assembly = mono_domain_assembly_open(domain, (absPath(getExecutablePath()) + "\..\Debug\MyDLL.dll").c_str());
if (!assembly) {
std::cout << "Error, 'assembly' is null\n";
}
else {
MonoImage* image = mono_assembly_get_image(assembly);
// Carregar todoas as classes....
}