c#從plugin中獲取數據

特別是想從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做事情

}

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。