summaryrefslogtreecommitdiffstats
path: root/doc/global
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2019-04-30 09:39:21 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2019-06-28 06:47:29 +0200
commitf66c1db16c050c9d685a44a38ad7c5cf9f6fcc96 (patch)
tree53e38e8714d493e321e0437f4d4f59bd6f4aff10 /doc/global
parent8f0e3ad5188d17c88f624eeea9a67ab17e55cc6f (diff)
Introduce Q_NAMESPACE_EXPORT
A recurring problem with the Q_NAMESPACE macro is that it declares an object (staticMetaObject) in the surrounding namespace. That object lacks any export/import qualification to make it usable with shared libraries. Introduce therefore another macro to work around this issue, allowing the user to prefix the object with an exporting macro, f.i. like this: Q_NAMESPACE_EXPORT(Q_CORE_EXPORT) The old macro can simply then be rewritten in terms of this new one, supplying an empty export macro. Note that NOT passing an argument to a macro expecting one is well defined behavior in C99 -- the macro will expand an empty token. Of course, MSVC doesn't like this and emits warnings. As a workaround, use a variadic macro. [ChangeLog][QtCore] Added the new Q_NAMESPACE_EXPORT macro. It can be used just like Q_NAMESPACE to add meta-object information to a namespace; however it also supports exporting of such information from shared libraries. [ChangeLog][Potentially Source-Incompatible Changes] Prefixing Q_NAMESPACE with an export macro may no longer work. Use the new Q_NAMESPACE_EXPORT macro for that use case. Fixes: QTBUG-68014 Change-Id: Ib044a555ace1f77ae8e0244d824ec473550f3d8e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'doc/global')
-rw-r--r--doc/global/qt-cpp-defines.qdocconf1
1 files changed, 1 insertions, 0 deletions
diff --git a/doc/global/qt-cpp-defines.qdocconf b/doc/global/qt-cpp-defines.qdocconf
index a486470187..4cf895b05e 100644
--- a/doc/global/qt-cpp-defines.qdocconf
+++ b/doc/global/qt-cpp-defines.qdocconf
@@ -118,6 +118,7 @@ Cpp.ignoretokens += \
Q_POSITIONING_EXPORT \
Q_MULTIMEDIA_EXPORT \
Q_NAMESPACE \
+ Q_NAMESPACE_EXPORT \
Q_NETWORK_EXPORT \
Q_NEVER_INLINE \
Q_NORETURN \