C#调用native C++代码。需要从c#传入一个byte []。
目前的方法是用CLI写了一个Wrapper, 在Wapper中调用native C++。但是多线程调用的时候,会出现Acess Violation。
CLI Wrapper的代码如下:
Void Wrapper:: Test(array< unsigned char>^ buf, int len)
{
pin_ptr<unsigned char> pin_data = &buf[0];
nativeClass.test2(pin_data,len);
}
byte[]传入的方式有问题呢?谢谢。