C#调用C写的DLL要如何转换参数的数据类型

C写的方法

int rf_select(int icdev,unsigned long _Snr,unsigned char *_Size); 
C#:
[DllImport("mwrf32.dll")]
public static extern int rf_select(int icdev, long _Snr, ref byte _Size); 

可是调用的时候总是提示“尝试读取或写入受保护的内存。这通常指示其他内存已损坏。”
应该怎么做呢

admin -
  • admin - 1年前

    [DllImport("mwrf32.dll")]
    public static extern int rf_select(int icdev, uint _Snr, ref string _Size);