头文件#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);}请大家帮忙,谢谢了
#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);}请大家帮忙,谢谢了
没参数说明...
只能靠猜的写一下了: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操作指针就行了.
#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);
}整个代码就是这样的
unsigned char * -----byte*
unsigned long * -----uint* 或者 ref uint[DllImport("xxxx.dll",CallingConvention=CallingConvention.StdCall)]