PDA

View Full Version : What is the Use of QPluginLoader



KAMATCHI
20th October 2011, 12:57
Hi All,
I want to know why QPluginLoader is used.
For what purpose we use QPluginLoader.
QLibrary is mainly used to resolve symbols. But i dono y QPluginLoader mainly used for.
instance() method in QPluginLoader returns QObject Pointer.
Can we get the methods present inside library file using this QObject pointer.

I need some idea.

Thanks in Advance
Kamatchi

fullmetalcoder
20th October 2011, 14:16
They say madness is doing the same (http://www.qtcentre.org/threads/45356-How-to-View-Classes-and-Functions-inside-.so-library-file)[/URL] thing (http://www.qtcentre.org/threads/45356-How-to-View-Classes-and-Functions-inside-.so-library-file?p=206150&highlight=#post206150) and expecting different result...

QPluginLoader is a small wrapper around QLibrary that simplifies the process of loading a plugin. It will only work with dynamic libraries that follow a set of conventions (explained in Qt docs) to export some QObject subclasses.

When you load a plugin the usual assumption is that your application knows the type of object provided by the plugin (i.e when compiling your application, you had access to a header files describing the class and methods you expect to load from the plugins).

If this assumption does not hold but the dynamic library follows the conventions that make it loadable by QPluginLoader you can still retrieve some information via the [URL="http://doc.qt.nokia.com/latest/qobject.html#metaObject"]metaobject system (http://www.qtcentre.org/threads/45356-How-to-View-Classes-and-Functions-inside-.so-library-file).

If the dynamic library does not follow said conventions, Qt will not help you. Your only recourse will be to use platform-specific libraries (such as libelf) to inspect the library. You will also have to demangle C++ symbol names. Based on your insistence on asking the same question 3 times and ignoring the answers, you probably have no clue what this means so you should not even think about going down that road before seriously reading up on dynamic linking and C++ ABI...