Qt World Summit: Submit your Presentation

How to use QPluginLoader to view methods inside library

  • Hi All,
    I have created the library file libtest.so.
    I need to view the classes and methods present inside library.
    Is there any way to get those method names through QPluginLoader / QLibrary


  • Hi,

    I moved your topic to the general subforum. More people will see it there.

    The beta testing is for testing this forum website.

  • There are ways to see, what a library exports.
    If there is a way to reconstuct the object structure, I don't know.
    Doping this via QPluginLoader / QLibrary is not possible.
    Both are used to load libraries. QPluginLoader for plugins, QLibary in gerenal (QPluginLoader uses QLiabry internally).
    With QLibarary, you can find methods in a lib, but not list them.

  • Ok thanks for ur reply.

    But the instance() method in QPluginLoader returns QObject pointer
    Can i get class names from the QOBjectPointer( returned by QPluginLoader)

  • If you look at the source code of QPluginLoader, it shows:

    it loads a library with QLibrary

    it resolves a specific function with QLibrary::resolve

    it calls that function, which be definition returns a QObject pointer

    If all this is compiled with RTTI, you can use RTTI functions to get the real class names
    If the returned classes have correct Qt meta info, you can usethe QMetaInfo API to retreive class names.

  • Thanks for ur reply

    Through MetaInfo i can get the class Name.
    But i want to get all the classes and method names used inside the library.
    Is it possible?

  • Not using pure Qt. Take a look at tools like nm (part of "binutils":http://www.gnu.org/software/binutils/).

Log in to reply