Results 1 to 4 of 4

Thread: stand alone dll under qt application

  1. #1
    Join Date
    Jun 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default stand alone dll under qt application

    Hi,

    I have non-Qt GUI application which use also Qt core application in one component of it to use Qt thread support.

    I have also external dll base on Qt which create Qt application for GUI porpuse (extern C API).

    When i try to load the dll and to create QApplication i got the error of multiple Qt applications which can't be done.

    Is there a way to make the dll to be independent when i can load and use it regarless to the loader (which can be Qt application too) ?

    Thanks,

    Ami

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,709
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: stand alone dll under qt application

    I have non-Qt GUI application which use also Qt core application in one component of it to use Qt thread support.
    You should not use a QApplication or QCoreApplication in a DLL, since the application using the DLL will have that.
    You can use QThread in your DLL even if you do not use QCoreApplication in your DLL, since the application which loads the DLL has a QApplication running, and it will deal with the QThread or any Qt events.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jun 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: stand alone dll under qt application

    This dll is used also on consol application which don't have Qt application instanse.
    This dll designed to be stand alone so it will loaded on several environments so it must have QApplication instanse

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,709
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: stand alone dll under qt application

    Well,you can design anything you want, but if you don't pay attention to the restrictions you have, it just wont work.
    I would suggest to you to split that DLL in to two DLLs - one that hold the non Qt dependent functionality, and another which is Qt DLL.
    This way you can have the non Qt DLL still offer functionality to non Qt applications.

    Another option, which I am not sure if it has other problems, is that applications using your DLL will use its QApplication.
    You might try declaring your QApplication variable as external.
    The problem with this approach is, that Qt application that will need to link to this DLL will have to be designed specifically to work that way.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. How Do I Deploy Application Into Single .exe Stand Alone File
    By Deshi in forum Installation and Deployment
    Replies: 4
    Last Post: 25th January 2010, 23:26
  2. Can't execute a Stand Alone Qt Application after compiling
    By aarelovich in forum Qt Programming
    Replies: 5
    Last Post: 8th October 2009, 18:59
  3. Replies: 2
    Last Post: 21st August 2009, 05:54
  4. Stand-alone colorbar (no canvas)
    By llamas in forum Qwt
    Replies: 3
    Last Post: 20th August 2008, 09:47
  5. how to make a stand alone .exe with VS
    By Masih in forum General Programming
    Replies: 1
    Last Post: 20th May 2007, 08:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.