DLL程序中,导出变量,函数,类。
如果类中包括函数,就不用导出函数。
导出函数
extern "C" __declspec(dllexport) int AddTextAdd(void);
导出类
extern "C" class __declspec(dllexport) CAdd
导出变量
extern "C" __declspec(dllexport) int a;
MFC中使用DLL
在需要调用DLL的CPP文件中,使用
#pragma comment(lib,"AddText.lib")连接
在主程序中,要么使用头文件,要么使用导入方式。
导入方式,在cpp中
extern "C" int AddTextAdd(void);
如果类中包括函数,就不用导出函数。
导出函数
extern "C" __declspec(dllexport) int AddTextAdd(void);
导出类
extern "C" class __declspec(dllexport) CAdd
导出变量
extern "C" __declspec(dllexport) int a;
MFC中使用DLL
在需要调用DLL的CPP文件中,使用
#pragma comment(lib,"AddText.lib")连接
在主程序中,要么使用头文件,要么使用导入方式。
导入方式,在cpp中
extern "C" int AddTextAdd(void);