How to include plugin



  • Hello Qt community.

    I build echoplugin example and get echoplugin.dll.

    Now I'm trying to use plugin from new application.
    How to include plugin in new application?



  • Hello,
    You should use QPluginLoader (with Qt 4, in don't know yet in Qt5) pass the library file to the constructor or to setFileName() and then call instance().
    If you did all this then you can use the object you got as a normal object and call its methods (and even meta-methods)
    Hope this is detailed enough to help you.
    Pascom


  • Moderators

    you may want to read "this":http://qt-project.org/doc/qt-4.8/plugins-howto.html for a better understanding.

    Also what would be good to know is:
    Do you want to use it as plugin? Meaning to load it automatically only if it's present in the system? And if it's not present you jsut miss the functionality in your applciation. If so you should use QPluginLoader or QLibrary (if it contains C-exportetd symbols).

    If you want to make it an dependency of your application (something your application can't run without it) you would need to link to the library. Then read "this":http://qt-project.org/wiki/How_to_create_a_library_with_Qt_and_use_it_in_an_application.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.