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. QtRO in non-qt dynamic library
QtWS25 Last Chance

QtRO in non-qt dynamic library

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 3 Posters 824 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.
  • VoukV Offline
    VoukV Offline
    Vouk
    wrote on last edited by
    #1

    I am currently evaluating Qt to replace another C++ framework I'm currently using ... as Qt has many advantages over it.

    I have a set of (currently) non-qt plugin-libraries (lets say a DaVinci Resolve plugin) that'd send the frame buffer to a Qt Application (either app or library) which then deals with that data and saves it to disk.

    Previousely I did this with COM in Windows, which worked fine, but I'd like to go cross platform now and I like the idea of using Qt Remote Objects for IPC.

    But using QtRO in a non-qt dynamic library requries a QCoreApplication to be exec()'ed and the event loop to be handled.

    I failed so far.

    • Is there a way to create a QCoreApplication incl. the event-loop running in a dynamic library (on Win, Mac, Linux)?
    • Get signals/slots on that object working?
    • The remaining plugin functionality should still be working

    I did try to use a tcp client/server. It works, but I don't like to invent the wheel again.

    jsulmJ 1 Reply Last reply
    0
    • VoukV Vouk

      I am currently evaluating Qt to replace another C++ framework I'm currently using ... as Qt has many advantages over it.

      I have a set of (currently) non-qt plugin-libraries (lets say a DaVinci Resolve plugin) that'd send the frame buffer to a Qt Application (either app or library) which then deals with that data and saves it to disk.

      Previousely I did this with COM in Windows, which worked fine, but I'd like to go cross platform now and I like the idea of using Qt Remote Objects for IPC.

      But using QtRO in a non-qt dynamic library requries a QCoreApplication to be exec()'ed and the event loop to be handled.

      I failed so far.

      • Is there a way to create a QCoreApplication incl. the event-loop running in a dynamic library (on Win, Mac, Linux)?
      • Get signals/slots on that object working?
      • The remaining plugin functionality should still be working

      I did try to use a tcp client/server. It works, but I don't like to invent the wheel again.

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Vouk said in QtRO in non-qt dynamic library:

      Is there a way to create a QCoreApplication incl. the event-loop running in a dynamic library

      Why do you want to do this in the library? You do that in the application which uses the library.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • VoukV Offline
        VoukV Offline
        Vouk
        wrote on last edited by Vouk
        #3

        @jsulm said in QtRO in non-qt dynamic library:

        Why do you want to do this in the library? You do that in the application which uses the library.

        Because I don't have access to the application that uses that dynamic library (the plugin).

        ([DaVinci Resolve.exe] <--> [Plugin.dll]) <--> ([Qt App.exe])
                   1                      2                  3
        
        • 1 is the non-qt host application (actually it uses Qt 5.4.1 but I don't want any dependency to it as other host applications i.e. Adobe Premiere do not use Qt)
        • 2 The plugin is developed by me and is being loaded by the host application and running in it process.
        • 3 The Qt application (maybe a service/daemon) is also developed by me and does all the work. I just need the plugin (2) to create some standard interface between (1) and (3). Previousely (3) was a COM server and (2) used it as a COM client. But that was working on windows only.

        The question is: What do I need to do to get Remote Objects between (2) and (3) working? As both of them are separate processes we need some kind of IPC. Is it possible to somehow "inject" the Qt event loop stuff into it so I can get Remote Objects working? Or maybe there is another way?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Did you already saw this stack overflow answer about a Qt application started from a .dll ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • VoukV Offline
            VoukV Offline
            Vouk
            wrote on last edited by
            #5

            Well, unfortunately this seems only to be working with calling regular methods. What I get this when start using the Remote Object:

            QWinEventNotifier: Can only be used with threads started with QThread

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Can you share the code you are using ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • VoukV Offline
                VoukV Offline
                Vouk
                wrote on last edited by Vouk
                #7

                Sorry, the example from StackOverflow is working for windows only. So it won't be sufficient. I'd really like to go with Win, Mac and Linux (dll, dylib and so).

                That brings me back to the beginning: I have a shared library project with no Qt in it and exporting the function "helloWorld()". This shared library would be the remote objects source and in that function i'd like to (i.e.) trigger the timer of the QtRO example here: https://doc.qt.io/qt-5/remoteobjects-example-static-source.html

                The thing is I am not in any QThread, it'll be a random C function in that library where I'd like to trigger the remote objects the communicates with that Qt app running.

                Or very basic: How can a non-Qt library in one process communicate with a Qt app in another process?

                Or do I have to go outside Qt? Like boost::ipc in both components or similar?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  For macOS, this could be a starting point.

                  Before going further, what will you be sending from DaVinci Resolve to your own application ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • VoukV Offline
                    VoukV Offline
                    Vouk
                    wrote on last edited by Vouk
                    #9

                    It took a while but I think I've found a nice way with a lightweight RESTful client / server approach using the loopback device. According to my tests it can handle up to 10000 requests / sec. To handle the big uncompressed UHD video frames (~66 MBytes) I use boost's shared_memory_object. It seems to be working so far with a reasonable performance.

                    This way I don't have to somehow force/hack Qt into native dynamic libaries.

                    1 Reply Last reply
                    1
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      ZeroMQ might also be of interest depending on the protocol you need.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      1
                      • VoukV Offline
                        VoukV Offline
                        Vouk
                        wrote on last edited by
                        #11

                        It's an interesting project. Unfortunately Windows 10 support is bugged and the project is GPL. I'd require LGPL at least.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          For the licensing, you are wrong. It's currently LGPL v3 plus a static linking exception and they are moving to MPLv2.

                          See their wiki

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          1
                          • VoukV Offline
                            VoukV Offline
                            Vouk
                            wrote on last edited by
                            #13

                            I'll wait until Win10 support is fixed and IPC works also without unix domain sockets. But besides that issues it looks promising.

                            1 Reply Last reply
                            0

                            • Login

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