美文网首页
c#从plugin中获取数据

c#从plugin中获取数据

作者: 土豆的尾巴 | 来源:发表于2016-05-18 10:53 被阅读0次

特别是想从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做事情

}

相关文章

网友评论

      本文标题:c#从plugin中获取数据

      本文链接:https://www.haomeiwen.com/subject/hofwrttx.html