特別是想從plugin中獲取byte[]類似的數據,目前的做法一般如下:
c++: ? void test(char** p, int* len)
{
xxxxxx賦值
}
c#
[DllImport(DLLNAME)]
public static extern void test(out IntPtr buf, out int Len);
{
int len;
IntPtr buf;
test(out buf, out len);
var arr = new byte[len];
System.Runtime.InteropServices.Marshal.Copy(buf, arr, 0, len);
///
xxxxx用arr做事情
}