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;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/233680.html
標籤:C++ 語言
上一篇:VS2017
