比如:
__declspec(dllexport) int card(int icdev,unsigned char _Mode,unsigned long *_Snr);
__declspec(dllexport) int request(int icdev,unsigned char _Mode,unsigned int  *TagType);这里的unsigned long *_Snr  和unsigned int  *TagType 在C#里如何表示啊?谢谢了!

解决方案 »

  1.   

    ref uint _Snr, ref uint TagType
      

  2.   

    ref UInt32 _Snrref UInt32 TagType
      

  3.   

    貌似不对啊,
    我这样定义:
    public static extern int card(int icdev, byte _Mode, ref UInt32 _Snr);这样调用:
    UInt32 res = 0;
    CHOper.card(0, 0, ref res);到调用这句时程序就假死了,是不是这个参数对应得不对啊?
      

  4.   

    参数对应应该是没有问题的,或者lz换成ref UInt64试试。不过我记得C++的long对应到C#中应该是int啊
      

  5.   


    unsigned long对应ulong吧?
      

  6.   


    unsigned long应该是对应ulong喔
      

  7.   

    32位编译的C++dll long是32位的,对应int
    可以试试
    int card(int icdev, byte _Mode, out uint _Snr);
      

  8.   

    out uint _Snr  这样也是一样的情况
      

  9.   

    有没有这两个函数的参数说明,数组也是可以写成 unsigned long *_Snr 这样的,另外还可能是参数的值不合适。
      

  10.   

    使用winsiggen,把C++代码复制进去,转换一下就知道了