To find a list of classes contained in a C# Class Library using Mono with C++

Asked

Viewed 137 times

0

I’m using C# to script through the project Mono with C++. I’m trying to get a list of all the classes contained in one DLL done on a project C# (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 doing a lot of research, but nothing of 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’s 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....
}
  • tries these tools http://www.dependencywalker.com/ https://msdn.microsoft.com/en-us/library/756as972%28v=VS.90%29.aspx

  • The class name is compiler-to-compiler variable. If you made the API in C++, I recommend turning it into a C

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.