Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to run Qt Application(GUI) from DLL?
Forum Update on Monday, May 27th 2025

How to run Qt Application(GUI) from DLL?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 644 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Konstantin13
    wrote on 27 Jan 2021, 11:42 last edited by
    #1

    Hello everyone.
    I need your advice. How to run Qt Application(GUI) from DLL? I have a console application C++, and I want to load DLL then run Qt application GUI from that DLL. How can I do that?

    R 1 Reply Last reply 27 Jan 2021, 12:53
    0
    • K Konstantin13
      27 Jan 2021, 11:42

      Hello everyone.
      I need your advice. How to run Qt Application(GUI) from DLL? I have a console application C++, and I want to load DLL then run Qt application GUI from that DLL. How can I do that?

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 27 Jan 2021, 12:53 last edited by
      #2

      @Konstantin13
      same way you would do in an application/exe.
      Start a QApplication event loop.
      But note that each process (the instance loading your dll) can only have a single QApplication. If thats not possible you will need to launch a separate process from within your dll and communicate with the launched application.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      K 1 Reply Last reply 27 Jan 2021, 14:10
      3
      • C Online
        C Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on 27 Jan 2021, 12:54 last edited by
        #3

        Or turn around the dependency - create a lib with the functionality of the console application and then use this library from a console or gui app.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        2
        • R raven-worx
          27 Jan 2021, 12:53

          @Konstantin13
          same way you would do in an application/exe.
          Start a QApplication event loop.
          But note that each process (the instance loading your dll) can only have a single QApplication. If thats not possible you will need to launch a separate process from within your dll and communicate with the launched application.

          K Offline
          K Offline
          Konstantin13
          wrote on 27 Jan 2021, 14:10 last edited by
          #4

          @raven-worx thank`s, I did as you say and everything works!
          I have already familiarized myself with the problems associated with processes. Now I have a new question : how I can communicate with UI(Qt) from my application and back???

          R 1 Reply Last reply 27 Jan 2021, 14:33
          0
          • K Konstantin13
            27 Jan 2021, 14:10

            @raven-worx thank`s, I did as you say and everything works!
            I have already familiarized myself with the problems associated with processes. Now I have a new question : how I can communicate with UI(Qt) from my application and back???

            R Offline
            R Offline
            raven-worx
            Moderators
            wrote on 27 Jan 2021, 14:33 last edited by
            #5

            @Konstantin13 said in How to run Qt Application(GUI) from DLL?:

            how I can communicate with UI(Qt) from my application and back???

            https://doc.qt.io/qt-5/ipc.html
            or
            https://doc.qt.io/qt-5/qtremoteobjects-index.html

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            2

            1/5

            27 Jan 2021, 11:42

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved