我有一个非托管C ++函数,其内容如下:int myfunction(LPVOID p1, LPVOID p2)
我在C#中的包装器需要extern static int mywrapperFunction(IntPtr p1, IntPtr p2)
在我的包装函数定义中,我想将IntPtr推荐给一个结构。
在C ++中:
int myfunction(LPVOID p1, LPVOID p2)
{
(MYFIRSTSTRUCTURE *)abc = (MYFIRSTSTRUCTURE *)p1;
(MYSECONDSTRUCTURE *)efg = (MYSECONDSTRUCTURE *)p1;
//rest of the operation involves this abc and efg
}
我需要在C#中做类似的事情:
int mywrapperFunction(IntPtr p1, IntPtr p2)
{
//how to consume IntPtr p1 and IntPtr p2 for C# structure similar to MYFIRSTSTRUCTURE and //MYSECONDSTRUCTURE
}