C# Custom Marshalling or Managed C++ wrapper.

Dec 20 2008 9:20 AM

I have a C++ Component class being written in a DLL and a DLL export funtion that returns the pointer to the Component Class.

class Component
{
    char* name;
    char* id;
    char* version;
    char* description;
    Component* parent;
    std::list<Component*> children;
}

DLLEXPORT Component* Enumerate()
{
 return Module::GetInstance();
}

In my C# Application, in order to access the Component class using the Enumerate funtion,  do I need to use managed C++/CLI wrapper or use

Marshal.PtrtoStructure or ICustomMarshalling

What is the correct way to do this?


Answers (3)