[英]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. 我正在为dll写一个包装器。 The dll has a method whose signature resembles the following:
dll的签名类似于以下方法:
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. 我在Google上搜索了一个教程,以让我深入了解如何在C#上编写签名,以便框架可以完成编组过程。
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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.