C++ method declaration including a macro

只愿长相守 提交于 2019-12-07 16:55:26

It means that the class is either exported or imported, depending on which module is built.

If QUICKFAST_HAS_DLL is defined and equal to 1, it means that the module is built as a DLL. To use functionalities from the outside, classes and methods have to be exported.

Inside the module, QUICKFAST_BUILD_DLL is defined. So when you build the module, QuickFAST_Export expands to __declspec(dllexport). Your class definition becomes:

class __declspec(dllexport) Message : public FieldSet

When you include the header from a different module, QUICKFAST_BUILD_DLL is not defined, so the macro expands to __declspec(dllimport), and your class definition to:

class __declspec(dllimport) Message : public FieldSet

The macro expands to either __declspec(dllimport) or __declspec(dllexport), depending if the class is exported from the DLL or imported on the other side.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!