diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-09 15:54:01 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-12 13:04:27 +0200 |
commit | d9f9bc9bada91e3ec2b6c496d3b2242506ca56bc (patch) | |
tree | e9b38267bae5e84ac73cff38c5daafed9aaddf4b /src/corelib/kernel/qmetatype.cpp | |
parent | b1e234b2242b7ed1ce4001ae29abecf5ae74fadf (diff) |
QMetaType: Avoid combination of extern and declspec(__dllexport) on MSVC
MSVC does strange things with this, and it actually tells us so via a
warning. We can, however, attach the dllexport to the definition, rather
than the declaration of the symbols in order to resolve the problem.
Change-Id: I9971e13afc6d8840c49ec20d21820a72c5407200
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qmetatype.cpp')
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 60588e9329..c9a0a40cd0 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -2925,14 +2925,23 @@ QMetaType::QMetaType(int typeId) : QMetaType(interfaceForType(typeId)) {} namespace QtPrivate { #ifndef QT_BOOTSTRAPPED + +#if defined(Q_CC_MSVC) && defined(QT_BUILD_CORE_LIB) +#define QT_METATYPE_TEMPLATE_EXPORT Q_CORE_EXPORT +#else +#define QT_METATYPE_TEMPLATE_EXPORT +#endif + // Explicit instantiation definition -#define QT_METATYPE_DECLARE_TEMPLATE_ITER(TypeName, Id, Name) template class QMetaTypeForType<Name>; +#define QT_METATYPE_DECLARE_TEMPLATE_ITER(TypeName, Id, Name) \ + template class QT_METATYPE_TEMPLATE_EXPORT QMetaTypeForType<Name>; QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(QT_METATYPE_DECLARE_TEMPLATE_ITER) QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(QT_METATYPE_DECLARE_TEMPLATE_ITER) QT_FOR_EACH_STATIC_CORE_CLASS(QT_METATYPE_DECLARE_TEMPLATE_ITER) QT_FOR_EACH_STATIC_CORE_POINTER(QT_METATYPE_DECLARE_TEMPLATE_ITER) QT_FOR_EACH_STATIC_CORE_TEMPLATE(QT_METATYPE_DECLARE_TEMPLATE_ITER) #undef QT_METATYPE_DECLARE_TEMPLATE_ITER +#undef QT_METATYPE_TEMPLATE_EXPORT #endif } |