开发者

How can I write a signature on C# for a wrapped C++ method having a pointer to a function it its arguments?

开发者 https://www.devze.com 2023-04-04 12:25 出处:网络
I\'m writing a wrapper for a dll. The dll has a method whose signature resembles the following: unsigned long aMethod(void *anyParameter,

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号