immagine the .h file looks like this
class MyClass {
void Insert(char *key);
char *Get();
};
your .cpp file would look like this
declspec(DLLEXPORT) void *MyClass_Create() {
MyClass *mc = new MyClass();
return mc;
}
declspec(DLLEXPORT) void MyClass_Delete(void *InstancePtr) {
MyClass *c = InstancePtr;
delete c;
}
declspec(DLLEXPORT) void MyClass_Insert(void *InstancePtr,char *key) {
MyClass *inst = (MyClass*) InstancePtr;
inst->Insert(key);
}
and so on
then in your C# file
you can use
[DllImport("MyClass.dll", EntryPoint="MyClass_Insert", ExactSpelling=false,
SetLastError=true)]
static extern void MyClass_Insert(
[MarshalAs(UnmanagedType.IntPtr)] IntPtr InstancePtr,
[MarshalAs(UnmanagedType.CharArray)] byte[] String);
to call the method
hope this helps