我在 C++ 中有这个函数,我想在 c# 中导入它
BS_RET_CODE BS_ReadImage( int handle, int imageType, unsigned char* bitmapImage, int* imageLen)
我试过了
[DllImport("BS_SDK.dll",CharSet = CharSet.Ansi, EntryPoint = "BS_ReadImage")]
public static extern int BS_ReadImage(int handle, int imageType, IntPtr bitmapImage, ref int imageLen);
IntPtr image = new IntPtr();
int len = 0;
BSSDK.BS_ReadImage(m_Handle, 0xff, image, ref len);
byte[] _imageTemp = new byte[len];
Marshal.Copy(image, _imageTemp, 0, len);
但我得到一个访问冲突异常