45 #include <QtCore/qobject.h> 46 #include <QtCore/qpointer.h> 56 # define Q_EXTERN_C extern "C" 58 # define Q_EXTERN_C extern 62 typedef QObject *(*QtPluginInstanceFunction)();
66 #define Q_IMPORT_PLUGIN(PLUGIN) \ 67 extern QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGIN(); \ 68 class Static##PLUGIN##PluginInstance{ \ 70 Static##PLUGIN##PluginInstance() { \ 71 qRegisterStaticPluginInstanceFunction(qt_plugin_instance_##PLUGIN); \ 74 static Static##PLUGIN##PluginInstance static##PLUGIN##Instance; 76 #define Q_PLUGIN_INSTANCE(IMPLEMENTATION) \ 78 static QT_PREPEND_NAMESPACE(QPointer)<QT_PREPEND_NAMESPACE(QObject)> _instance; \ 80 _instance = new IMPLEMENTATION; \ 84 # define Q_EXPORT_PLUGIN(PLUGIN) \ 85 Q_EXPORT_PLUGIN2(PLUGIN, PLUGIN) 87 # define Q_EXPORT_STATIC_PLUGIN(PLUGIN) \ 88 Q_EXPORT_STATIC_PLUGIN2(PLUGIN, PLUGIN) 90 #if defined(QT_STATICPLUGIN) 92 # define Q_EXPORT_PLUGIN2(PLUGIN, PLUGINCLASS) \ 93 QT_PREPEND_NAMESPACE(QObject) \ 94 *qt_plugin_instance_##PLUGIN() \ 95 Q_PLUGIN_INSTANCE(PLUGINCLASS) 97 # define Q_EXPORT_STATIC_PLUGIN2(PLUGIN, PLUGINCLASS) \ 98 Q_EXPORT_PLUGIN2(PLUGIN, PLUGINCLASS) 106 # ifdef QPLUGIN_DEBUG_STR 107 # undef QPLUGIN_DEBUG_STR 110 # define QPLUGIN_DEBUG_STR "false" 111 # define QPLUGIN_SECTION_DEBUG_STR "" 113 # define QPLUGIN_DEBUG_STR "true" 114 # define QPLUGIN_SECTION_DEBUG_STR ".debug" 116 # define Q_PLUGIN_VERIFICATION_DATA \ 117 static const char qt_plugin_verification_data[] = \ 118 "pattern=QT_PLUGIN_VERIFICATION_DATA\n" \ 119 "version=" QT_VERSION_STR "\n" \ 120 "debug=" QPLUGIN_DEBUG_STR "\n" \ 121 "buildkey=" QT_BUILD_KEY; 123 # if defined (Q_OF_ELF) && defined (Q_CC_GNU) 124 # define Q_PLUGIN_VERIFICATION_SECTION \ 125 __attribute__ ((section (".qtplugin"))) __attribute__((used)) 127 # define Q_PLUGIN_VERIFICATION_SECTION 130 # if defined (Q_OS_WIN32) && defined(Q_CC_BOR) 131 # define Q_STANDARD_CALL __stdcall 133 # define Q_STANDARD_CALL 136 # define Q_EXPORT_PLUGIN2(PLUGIN, PLUGINCLASS) \ 137 Q_PLUGIN_VERIFICATION_SECTION Q_PLUGIN_VERIFICATION_DATA \ 138 Q_EXTERN_C Q_DECL_EXPORT \ 139 const char * Q_STANDARD_CALL qt_plugin_query_verification_data() \ 140 { return qt_plugin_verification_data; } \ 141 Q_EXTERN_C Q_DECL_EXPORT QT_PREPEND_NAMESPACE(QObject) * Q_STANDARD_CALL qt_plugin_instance() \ 142 Q_PLUGIN_INSTANCE(PLUGINCLASS) 144 # define Q_EXPORT_STATIC_PLUGIN2(PLUGIN, PLUGINCLASS) #define QT_END_NAMESPACE
This macro expands to.
void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunction function)
Registers the given function with the plugin loader.
The QObject class is the base class of all Qt objects.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QObject *(* QtPluginInstanceFunction)()