[PATCH] kcmoduleinfo [WAS] Plugin linking problem

David Faure faure at kde.org
Thu Aug 9 23:10:52 BST 2007


On Thursday 09 August 2007, Rafael Fernández López wrote:
> Well, as they have different factories, they have different entry points.
> That's the thing, both .desktop files provide X-KDE-FactoryName, so each one
> enters through that symbol.

./docwordcompletion_config.cpp:34:K_EXPORT_COMPONENT_FACTORY( \
./docwordcompletion_config.cpp-35-    ktexteditor_docwordcompletion_config, \

Ah -- OK. That's cheating :)
The first argument to K_EXPORT_COMPONENT_FACTORY is supposed to be the libname,
but in this case it's something else. Of course that works, with X-KDE-FactoryName telling
the loading code what to load (which is a kcmodule-extension, standard plugin-loading
mechanism form KService doesn't have that...).

So it works...... but it's using a deprecated code path in KLibLoader.
Simon deprecated the loading of init_foo (K_EXPORT_COMPONENT_FACTORY)
and recommended using the Qt plugin mechanism instead, Q_EXPORT_PLUGIN, which has 
a fixed name for the plugin entry point. Most KDE code hasn't been ported to Q_EXPORT_PLUGIN,
and this is the reason for all the "qt_plugin_instance not found" warnings on stderr since
KLibLoader calls KLibraryPrivate::kde4Factory first (which does the Qt way) and then
KLibraryPrivate::kde3Factory (which looks for init_<libname> or init_<factoryname> if set).

About this limitation of Q_EXPORT_PLUGIN: I see a Q_EXPORT_PLUGIN2, 
but I do not see any use of the "PLUGIN" argument in this macro...
#  define Q_EXPORT_PLUGIN2(PLUGIN, PLUGINCLASS)      \
            Q_PLUGIN_VERIFICATION_DATA \
            Q_EXTERN_C Q_DECL_EXPORT \
            const char * Q_STANDARD_CALL qt_plugin_query_verification_data() \
            { return qt_plugin_verification_data; } \
            Q_EXTERN_C Q_DECL_EXPORT QObject * Q_STANDARD_CALL qt_plugin_instance() \
            Q_PLUGIN_INSTANCE(PLUGINCLASS)
So surely this doesn't allow to export more than one plugin from a plugin-library, does it?

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list