Convert my mainwindow in one library with Qt



  • Hi i did one program but now i want to convert in one .dll to use when the program needs to include the features of this library. When i say library i'm refering in one dll. dynamic link library or static link library. And then use like any .dll is possible? some suggestion or idea how i can update this?


  • Qt Champions 2016

    Hi
    If the app using this DLL, is also a Qt Application, you can use Qt plugins
    http://doc.qt.io/qt-5/plugins-howto.html
    the "The Low-Level API: Extending Qt Applications" section.
    That will make it just works.

    If the using App is Not qt, then you have issue of where the event loop runs and it will
    be much harder.

    So please give more information of your actual goal.



  • @mrjj the app is not qt, and i have one little question about this. If i include one static library in one .dll dynamic link library with qt i can use this static link library with my dll and use all functions and all like one dynamic link library. The only thing that my .dll is written with qt but my app is not using qt so for this i ask.


  • Qt Champions 2016

    Well if you app is not Qt then it much more complicated as the App will have event loop not
    taking into account Qt exits. And GUI controls only likes to live in MainThread.

    So yes its possible to I dont know the details so hopefully someone can tell you.
    Tried to google for it but didn't find anything good. :(

    This explains (some of) the issues
    http://stackoverflow.com/questions/25025168/event-loop-in-qt-based-dll-in-a-non-qt-application



  • @mrjj i must to use QMfcApp::pluginInstance to avoid event loop problem ok. It's good. The only thing is i can include in one dynamic link library my static link library and use all features of this static link library in my dynamic link library ┬┐Maybe it's not good do this what do you think? And sorry for all and thx for your help!


  • Qt Champions 2016

    Oh is your non Qt App an MFC app ?
    Yes then QMfcApp can really help :)

    Hi if the static lib is the Qt
    and the Dynamic DLL is linked against it.
    Then it might work when you dynamically load the DLL from App X ( as it dont care for Qt)
    But it might also have issue. Mixing static and dynamic loading often is tricky unless its pure c++.
    Then the static part is just compiled into the Dyna Dll like any other code.
    But in case of Qt static. It might have issue with event loop or QApplication.
    I never tried it though.

    Lets wait some hours and see if other have more clear answer :)



  • @mrjj the only is using pure c++ but i will wait if someone know better but i think you are right


Log in to reply
 

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