Results 1 to 7 of 7

Thread: Can I create a QApplication inside a DLL?

  1. #1
    Join Date
    Feb 2006
    Posts
    31

    Default Can I create a QApplication inside a DLL?

    Hi,

    I have a program which is an app with QApplication. Can I just change the project file to make it a DLL (instead of EXE), and remove the main function and still keep my original QApplication?


    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Can I create a QApplication inside a DLL?

    Sure you can but you'll still need an executable linked to the shared library or your program won't launch...
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #3
    Join Date
    Feb 2006
    Posts
    31

    Default Re: Can I create a QApplication inside a DLL?

    Hi,

    I plan to write a DLL which contains a QApplication with a lot of gui(s) (It used to be a EXE, now I want to make it a DLL). And my customer will write another Qt EXE which also contains a QApplication with their gui(s). This EXE then link against my DLL.

    Is it possible?

    Thanks

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Can I create a QApplication inside a DLL?

    I don't think it's a good choice... Maybe it's better not to create a QApplication inside the dll and just use the one provided by the main binary? This would be the "usual" way to do it. Otherwise you'd have to implement those GUIs as a separate thread (you can't have two QApplication objects in the same thread, or even the same application -- you have to use QThread::exec instead).

    You should read about extending Qt applcations with plugins . Maybe the concept will become more clear then... and maybe that's what you really want.

  5. #5
    Join Date
    Jan 2006
    Posts
    30
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Can I create a QApplication inside a DLL?

    What if I need to create a dll which could be used from win api, mfc and Qt applications. In such a case I need QApplication inside dll for mfc/win api programs, but don't need for Qt-based apps. Is it possible to find from dll if application Qt-based or not ?

  6. #6
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Can I create a QApplication inside a DLL?

    why would you need to mix Qt and MFC/WinAPI ??? Are you sure you're working on the best design??? Your approach seems an overkill and AFAIK the only way to check if a dll uses Qt is to doit on your own by creating an exported function/variable and looking for it in the exported symbols of the dll... And that is an suicide as well!
    Current Qt projects : QCodeEdit, RotiDeCode

  7. #7
    Join Date
    Jan 2006
    Posts
    30
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Can I create a QApplication inside a DLL?

    It's not my decision to mix Qt and mfc. I simply have to do it. Anyway the problem was solved. I've exported function "init()" which must be called before dll using.

Similar Threads

  1. [SOLVED] DirectShow Video Player Inside Qt
    By ToddAtWSU in forum Qt Programming
    Replies: 16
    Last Post: 3rd November 2011, 07:47
  2. [Qt4.1] How to insert an image inside a Form?
    By Gonzalez in forum Qt Tools
    Replies: 5
    Last Post: 23rd September 2008, 11:20
  3. How to create directories??
    By paranoid_android in forum Qt Programming
    Replies: 3
    Last Post: 9th March 2006, 16:28
  4. create file in another directory
    By raphaelf in forum Qt Programming
    Replies: 3
    Last Post: 16th February 2006, 10:04
  5. using Mysql: Ca't create TCP/IP socket
    By blackliteon in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2006, 18:25

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.