Delphi提供了一个编码解码的Dll供C#调用。参数就是传入一个字符串,输出编码/解码后的字符串。
但非常不稳定,在C#连续调用的时候可能会在解码字符串后出现一个特殊的乱码。请高手指点是什么原因。C#Dll导入:
[DllImport("ASLCompileEngine.dll", CharSet = CharSet.Ansi)]
        public static extern string ASL_SMSDecode(string Encode);[DllImport("ASLCompileEngine.dll", CharSet = CharSet.Ansi)]
        public static extern string ASL_SMSEncode(string Encode);  

解决方案 »

  1.   

    去掉编码方式试试
    [DllImport("ASLCompileEngine.dll")]
    public static extern string ASL_SMSDecode(string Encode);[DllImport("ASLCompileEngine.dll")]
    public static extern string ASL_SMSEncode(string Encode);
      

  2.   

    试过了,没有用。Calling也试过,没有用。我在怀疑是不是和垃圾回收有关系。不是每次返回的结果都不正确。