C++函数里有个参数是指针类型,可以指向结构体A或者结构体B,
C#调用时,怎么申明它?
[DllImport("test.dll", EntryPoint="SetValue")]
public static extern int SetValue(ref int hHandle,ref A pt);
其中pt是指针,如果他只指向结构体A的话,我可以象上面那样申明,可是他若是指向另一个结构体B时,我就没办法用了;
高手指点,谢谢。
C#调用时,怎么申明它?
[DllImport("test.dll", EntryPoint="SetValue")]
public static extern int SetValue(ref int hHandle,ref A pt);
其中pt是指针,如果他只指向结构体A的话,我可以象上面那样申明,可是他若是指向另一个结构体B时,我就没办法用了;
高手指点,谢谢。
public static extern int SetValue(ref int hHandle,ref A pt);[DllImport("test.dll", EntryPoint="SetValue")]
public static extern int SetValue(ref int hHandle,ref B pt);
public static extern unsafe int SetValue(ref int hHandle,A* pt);甚至[DllImport("test.dll", EntryPoint="SetValue")]
public static extern unsafe int SetValue(ref int hHandle, void* pt);
public static extern int SetValue(ref int hHandle,[MarshalAs( UnmanagedType.LPStruct)]object pt);
结贴前再想问一下,我觉得.net的msdn总是查询不出实质的帮助,比如我选中Marshal.SizeOf,再按F1,总是没有命中帮助,这方面大家有何指教?
会不会帮助文档定位不对呢?我没找到msdn目录设置。