首先是这些东西必须要有
#ifndef _JN_ASYNC_SOCKET_CMN_H_
#define _JN_ASYNC_SOCKET_CMN_H_
//---------------------------------------------------------
#ifdef WIN32 // Windows
#ifdef JNASYNCSOCKETLIB_EXPORTS
#ifndef JN_ASL_API // 防止重复定义开始
#define JN_ASL_API __declspec(dllexport)
#endif // 防止重复定义结束
#else
#ifndef JN_ASL_API // 防止重复定义开始
#define JN_ASL_API __declspec(dllimport)
#endif // 防止重复定义结束
#endif
#ifndef JN_ASL_CALL // 防止重复定义开始
#define JN_ASL_CALL __stdcall
#endif // 防止重复定义结束
#else // linux编译时,该宏定义为空
#ifndef JN_ASL_API // 防止重复定义开始
#define JN_ASL_API
#endif // 防止重复定义结束
#ifndef JN_ASL_CALL // 防止重复定义开始
#define JN_ASL_CALL
#endif // 防止重复定义结束
#endif // 区分操作系统endif
//--------------------------------------------------------- ... #endif
要在给人家用的地方加上 定义的dllimport的宏定义
其次,要在.def文件里注明导出函数名字,防止因名字不对而找不到函数指针。