Fwd: [kdelibs/frameworks] kdecore/util: This makes K_EXPORT_PLUGIN work with Qt5 again.
David Faure
faure at kde.org
Mon Aug 6 22:04:41 UTC 2012
---------- Forwarded Message ----------
Subject: [kdelibs/frameworks] kdecore/util: This makes K_EXPORT_PLUGIN work
with Qt5 again.
Date: Monday 06 August 2012, 17:59:21
From: David Faure <faure at kde.org>
To: kde-commits at kde.org
CC: kde-frameworks at kde.org, thiago at kde.org
Git commit dfdb6762045bc47becf2d9abb2ac70e5463bd0a7 by David Faure.
Committed on 06/08/2012 at 17:58.
Pushed by dfaure into branch 'frameworks'.
This makes K_EXPORT_PLUGIN work with Qt5 again.
In other words, we provide more backwards compatibility than Qt5 does
itself (where Q_EXPORT_PLUGIN just breaks compilation)...
I'm not actually sure why Qt5 does that, it's easy to support to old
macro for compatibility, as proven here (the unittests pass, i.e. the
loading actually works).
This doesn't prevent porting our plugins (and loader, for incremental
migration) to "pure qt5 plugins" though, of course.
CCMAIL: thiago at kde.org, kde-frameworks at kde.org
M +12 -2 kdecore/util/kexportplugin.h
http://commits.kde.org/kdelibs/dfdb6762045bc47becf2d9abb2ac70e5463bd0a7
diff --git a/kdecore/util/kexportplugin.h b/kdecore/util/kexportplugin.h
index fe328ef..316d8fe 100644
--- a/kdecore/util/kexportplugin.h
+++ b/kdecore/util/kexportplugin.h
@@ -75,8 +75,18 @@ K_PLUGIN_VERIFICATION_DATA
#else
-#pragma message("Plugins are broken. Need to port to new plugin system.")
-#define K_EXPORT_PLUGIN(factory)
+#pragma message("K_EXPORT_PLUGIN is defined as a hack here, for compat. Port
to new plugin system (QT_PLUGIN_METADATA) instead.")
+
+#if defined (Q_OS_WIN32) && defined(Q_CC_BOR)
+#define Q_STANDARD_CALL __stdcall
+#else
+#define Q_STANDARD_CALL
+#endif
+
+#define K_EXPORT_PLUGIN(factory) \
+ Q_EXTERN_C Q_DECL_EXPORT QT_PREPEND_NAMESPACE(QObject) *
Q_STANDARD_CALL qt_plugin_instance() \
+ Q_PLUGIN_INSTANCE(factory) \
+ K_PLUGIN_VERIFICATION_DATA
#endif
-----------------------------------------
--
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. KDE Frameworks 5
More information about the Kde-frameworks-devel
mailing list