| 发表于:2007-07-12 10:11:587楼 得分:0 |
这样写头文件: //cmyclass.h #ifndef _cmy_class_h_ #define _cmy_class_h_ #ifdef _my_dll_export_ #define _dll_export_ __declspec(dllexport) #else #define _dll_export_ __declspec(dllimport) #endif class _dll_export cmyclass { ... }; #ifndef _my_dll_export_lib_ #pragma comment(lib, "mydll.lib ") #endif #endif 将_my_dll_export_和_my_dll_export_lib_加到dll 工程的预编译定义中。 这几个宏只是自己定义的名字,你可以随便改成自己要定义的名字即可。 对于调用者来讲,需要包含cmyclass.h文件,当然要指定头文件,lib文件的路径才能编译通过。 | | |
|