How can I write a signature on C# for a wrapped C++ method having a pointer to a function it its arguments?
I'm writing a wrapper for a dll. The dll has a method whose signature resembles the following:
unsigned long aMethod(void *anyParameter,
void (*anotherMethod)(const char *, void *))
I've searching at google for a tutorial to give me insight on开发者_开发问答 how to write the signature on C# so the framework can do the marshalling process.
How can it be written? Do you know about any tutorial, book or documentation on this subject?
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void AnotherMethodDelegate(string s, IntPtr anyParameter);
[DllImport("dllname",
CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Ansi)]
uint aMethod(IntPtr anyParameter, AnotherMethodDelegate anotherMethod);
精彩评论