在C++中我声明了两个方法:void Compress(BYTE * InBuffer, DWORD dwLength,BYTE * OutBuffer);
void DeCompress(BYTE * InBuffer, BYTE * OutBuffer);
然后我在C#中DllImport引入改dll,并想调用Compress,DeCompress。但是我在C#中该声明这两个函数的参数类型呢?如下声明的时候,调用失败:
[DllImport("FCLzw.dll",EntryPoint="Compress")]
static extern string Compress(ref string InBytes,int DwLength, ref string OutBytes);[DllImport("FCLzw.dll",EntryPoint="DeCompress")]
static extern void DeCompress(ref string InBytes,ref string OutBytes);
void DeCompress(BYTE * InBuffer, BYTE * OutBuffer);
然后我在C#中DllImport引入改dll,并想调用Compress,DeCompress。但是我在C#中该声明这两个函数的参数类型呢?如下声明的时候,调用失败:
[DllImport("FCLzw.dll",EntryPoint="Compress")]
static extern string Compress(ref string InBytes,int DwLength, ref string OutBytes);[DllImport("FCLzw.dll",EntryPoint="DeCompress")]
static extern void DeCompress(ref string InBytes,ref string OutBytes);
声明:
[DllImport("FCLzw.dll",EntryPoint="Compress")]
static extern void Compress(byte[] InBytes,int DwLength, byte[] OutBytes);
[DllImport("FCLzw.dll",EntryPoint="DeCompress")]
static extern void DeCompress(byte[] InBytes,byte[] OutBytes);试试如何?