方法步驟:
1.在創(chuàng)建靜態(tài)dll文件時(shí),定義宏變量DLL_FILE,如下:
#ifndef DLL_FILE
#define DLL_FILE
#endif
2.以下面方式聲明lib中classname的頭文件。
#ifdef DLL_FILE
class _declspec(dllexport) classname //導(dǎo)出類classname
#else
class _declspec(dllimport) classname //導(dǎo)入類classname
#endif
然后實(shí)現(xiàn)在cpp中實(shí)現(xiàn)該類。
3.將該頭文件和lib文件加入到調(diào)用classname的工程文件。
Powered by ScribeFire.