I have a DLL that contains a class that inherits from another abstract C++ class defined as following:
class PersonInterface
{
public:
virtual int __stdcall GetName() = 0;
};
The DLL exports a function that can be used in C# as following (following method is part of static class PersonManager):
[DllImport( "person.dll", CallingConvention = CallingConvention.Cdecl )]
public static extern bool GetPerson( out PersonInterface person );
where PersonInterface is defined in C# class as following:
[StructLayout( LayoutKind.Sequential )]
public class PersonInterface
{
}
I can successfully retrieve the C++ class instance like this:
PersonInterface person;
bool retrieved = PersonManager.GetPerson( out person );
However, the retrieved object is not of any use until GetName method can be called.
What else needs to be done in order to be able to be able to invoke GetName method on retrieved person object?
string name = person.GetName();