I have different classes exported from native dll’s. The classes that is exported, inherit from multiple pure abstract classes (interfaces). The dll’s differ, in that the concrete class they export may inherit from different abstract classes. The native dll’s is loaded dynamically with LoadLibrary in a C++/CLI wrapper. Is there a way I can expose the class hierarchy (inheritance reltions) of the concrete native class in the dll. So that I can use the class as different interfaces in .NET.
Native interface
class PrimaryAbstractClass
{
virtual void PrimaryMethod() = 0;
};
class SecondaryAbstractClass1
{
virtual void Method1() = 0;
};
class SecondaryAbstractClass2
{
virtual void Method2() = 0;
};
Dll 1
class ConcreteClass1: public PrimaryAbstractClass, public SecondaryAbstractClass1
{
virtual void PrimaryMethod();
virtual void Method1();
};
Dll 2
class ConcreteClass2: public PrimaryAbstractClass, public SecondaryAbstractClass2
{
virtual void PrimaryMethod();
virtual void Method2();
};
Intended C# usage (pseudo code)
PrimaryAbstractClassWrapper pacw = new Dll1.PrimaryAbstractClassWrapper();
((SecondaryAbstractClass2)pacw).Method2();