[Qt-interest] Using plugins.

MARTIN Pierre hickscorp at gmail.com
Fri Sep 9 17:59:55 CEST 2011


Hello List,

i have 3 distinct elements:
- A library (RE), which defines plugin interface.
- A program (REA) which interacts with objects exported in RE.
- A test plugin (REP), which is actually the target of my question.

i have a problem related to the loading of the external plugins via QPluginLoader.
My plugin interface declares a bunch of functions to allow the plugin loader to get a list of available classes within each plugin. Basically:

	class RELibOpt AbstractPlugin {
	public:
		typedef QMap<QString,QMetaObject const*> MOMap;
		// Constructors.
						AbstractPlugin				();
		// Implementable methods.
		virtual bool	initialize					() const;
		virtual MOMap	metaObjectsMap		() const	= 0;
	};
In the initialize method, i have a QDebug statement which is correctly outputed. This means that the plugin loader successfully loads my plugin, and that my library in turn successfully grabs a handle to the instanciated plugin.

In my plugin definition, it inherits QObject and AbstractPlugin in turn.

However, when storing the MOMap returned by my plugin, i can't instanciate any of the objects based on their metaobjects. The metaobject looks clean, but when i try to use newInstance() it returns 0 (Instead of instanciating objects in my plugin).

Does anyone has an idea on what could be causing that?
Thanks,
Pierre.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110909/5ceafea2/attachment.html 


More information about the Qt-interest-old mailing list