头文件#ifdef a
#define b_API __declspec(dllexport)
#else
#define b_API __declspec(dllimport)
#endifextern "C"
{b_API int __stdcall ZlibCompress(unsigned char **compr, unsigned long *comprLen, unsigned char *uncompr, unsigned long uncomprLen);b_API int __stdcall  ZlibUncompress(unsigned char *compr, unsigned long comprLen, unsigned char **uncompr, unsigned long *uncomprLen);}请大家帮忙,谢谢了

解决方案 »

  1.   

    没dll名,
    没参数说明...
    只能靠猜的写一下了:unsafe static extern int ZlibCompress(out byte* compr,ref uint comprLen, byte[] uncompr, uint uncomprLen);
    unsafe static extern int ZlibUncompress(byte[] compr, uint comprLen, out byte *uncompr, ref uint uncomprLen);
    LZ自己把DllImport补下.
    另外如果不能用unsafe只要把byte*换成IntPtr改用Marshal操作指针就行了.
      

  2.   

    Marshal  下有很多类 可以参照下
      

  3.   

    unsigned char **这种类型一般只在返回指针时才使用,数据压缩应该是不需要返回指针的,该不会是多写了个*吧?
      

  4.   

    说不定.如果它是被调用方来分配内存的话就可能是unsigned char **了
      

  5.   

    #ifdef GPSSUPPORT_EXPORTS
    #define GPSSUPPORT_API __declspec(dllexport)
    #else
    #define GPSSUPPORT_API __declspec(dllimport)
    #endifextern "C"
    {GPSSUPPORT_API int __stdcall ZlibCompress(unsigned char **compr, unsigned long *comprLen, unsigned char *uncompr, unsigned long uncomprLen);GPSSUPPORT_API int __stdcall  ZlibUncompress(unsigned char *compr, unsigned long comprLen, unsigned char **uncompr, unsigned long *uncomprLen);
    }整个代码就是这样的
      

  6.   

    unsigned char ** ----byte**
    unsigned char * -----byte*
    unsigned long * -----uint* 或者 ref uint[DllImport("xxxx.dll",CallingConvention=CallingConvention.StdCall)]