dll中全局变量在外部进行引用

在Windows中实际导出全局变量,您必须使用类似于export / import语法的语法,例如:

1 #ifdef COMPILING_THE_DLL
2 #define MY_DLL_EXPORT extern "C" __declspec(dllexport)
3 #else
4 #define MY_DLL_EXPORT extern "C" __declspec(dllimport)
5 #endif
6 
7 MY_DLL_EXPORT int my_global;

 

参考网址:

https://codeday.me/bug/20170811/55724.html

https://blog.csdn.net/mangobar/article/details/53390552

https://blog.csdn.net/silvervi/article/details/5055707

posted on 2018-08-05 15:36  鸳都学童  阅读(1548)  评论(0编辑  收藏  举报

导航