C 编写的seccli.dll函数如下:
int SEC_CliSign(char XmlInfo[3800], strlen(XmlInfo), out unsigned char UpSign [180], out nSigLen)strlen(XmlInfo)表示XmlInfo长度
nSigLen 表示UpSign长度.如何申明、调用!!!!

解决方案 »

  1.   

    (引用命名空间)using System.Runtime.InteropServices;
    [DllImport("User32.dll")]
    public static extern int SEC_CliSign(string XmlInfo, int strlen, ref string UpSign , ref int nSigLen);
      

  2.   

    按照以下方法进行调用,报异常
    System.ApplicationException: 未将对象引用设置到对象的实例。 ---> System.NullReferenceException: 未将对象引用设置到对象的实例。
       at Sky.BankAgent.Assembly.CCB.LibWrap.SEC_CliSign(String XmlInfo, Int32 strLen, String& UpSign, Int32& nSigLen)具体实现如下:[DllImport("seccli.dll",EntryPoint="SEC_CliSign")]
    public static extern int SEC_CliSign(string XmlInfo, int strLen, ref string UpSign, ref int nSigLen);//callint nSigLen = 0;
    int retId = 0;
    string _xmlInfo = sendData;
    string _upInfo = "";int strLen = _xmlInfo.Length;retId = LibWrap.SEC_CliSign(_xmlInfo, nSigLen, ref _upInfo, ref nSigLen);但执行"未将对象引用设置到对象的实例"错误.请高手帮忙.
      

  3.   

    比较简单的调用:
    使用tlbimp yourDLL
      

  4.   

    "mmens(快乐中前行!) "
    能说的具体点吗?
      

  5.   

    你的sendData是什么? 你调试一下看看是那条语句报的错
      

  6.   

    对不起,我给你写错了! 把ref 改成out
      

  7.   

    out 我也试过,都报"未将对象引用设置到对象的实例"这个错误。
      

  8.   

    你的sendData是什么? 
    你调试一下看看是那条语句报的错?
      

  9.   

    正常业务情况sendData为XML报文;目前我以字符串进行测试的。
      

  10.   

    Have a try![DllImport("seccli.dll")]
    public static extern int SEC_CliSign(
    [Out, MarshalAs(UnmanagedType.LPArray, SizeConst=180)]
    byte[] UpSign );//Call 
    byte[] bytUpSign = new byte[180];
    SEC_CliSign( bytUpSign );有高手这样指导我做,但应用到我提的问题中,不知道怎么处理?请救救我。