64,637
社区成员
发帖
与我相关
我的任务
分享
global_variable.h文件中
#ifndef global_variable_H
#define global_variable_H
struct _declspec(dllexport) testDllVar{int _test;};
extern "C" _declspec(dllexport) testDllVar var;
#endif //global_variable_H
global_variable.cpp中
testDllVar var;
封装后在main.cpp中调用
#pragma comment(lib,"global_variable.lib")
extern "C" _declspec(dllimport) testDllVar var; //列的数量
int main()
{
var._test;
return 0;
}