Q_DECL_EXPORT关键字含义 [英] Q_DECL_EXPORT keyword meaning
问题描述
Q_DECL_EXPORT int main(int argc,char ** argv)
在 int main(...)
之前的
推荐答案
摘录自 QT docs :
根据您的目标平台,Qt提供了特殊的宏,
包含必要的定义:
Depending on your target platform, Qt provides special macros that contain the necessary definitions:
- Q_DECL_EXPORT必须添加到编译共享库时使用的符号声明。
- Q_DECL_IMPORT必须添加到编译使用共享库的客户端时使用的符号声明。
我没有检查QT代码,但很可能这个宏将执行以下操作:
I haven't check the QT code, but most likely this macro will do following:
#ifdef _WIN32 || _WIN64
#define Q_DECL_EXPORT __declspec(dllexport)
#define Q_DECL_IMPORT __declspec(dllimport)
#else
#define Q_DECL_EXPORT
#define Q_DECL_IMPORT
#endif
__ declspec(dllimport)
and __ declspec(dllexport)
告诉链接器分别从或向DLL导入和导出符号。
__declspec(dllimport)
and __declspec(dllexport)
tells the linker to import and export (respectively) a symbol from or to a DLL. This is Windows specific.
在特定情况下,此宏可能会被删除,因为 main()
不是图书馆的一部分。
In your particular case this macro probably could be removed, since main()
most likely is not part of a library.
这篇关于Q_DECL_EXPORT关键字含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!