#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
# define Q_DECL_EXPORT __declspec(dllexport)
# define Q_DECL_IMPORT __declspec(dllimport)
#else
# define Q_DECL_EXPORT __attribute__((visibility("default")))
# define Q_DECL_IMPORT __attribute__((visibility("default")))
#endif
#if defined(XXX_LIBRARY)
# define XXX_EXPORT Q_DECL_EXPORT
#else
# define XXX_EXPORT Q_DECL_IMPORT
#endif
class XXX_EXPORT XXX
{
}
编写库的宏定义导入导出
最新推荐文章于 2024-08-26 11:11:46 发布
这篇博客探讨了在C++中用于库导出和导入的宏定义,包括_MSVC_VER, WIN64, _WIN32等条件判断,以及Q_DECL_EXPORT和Q_DECL_IMPORT的使用方法,适用于Windows和非Windows平台的跨平台开发。
627

被折叠的 条评论
为什么被折叠?



