QtRO in non-qt dynamic library
-
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.
-
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.
@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.
-
@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?
-
Hi,
Did you already saw this stack overflow answer about a Qt application started from a .dll ?
-
Can you share the code you are using ?
-
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?
-
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.
-
ZeroMQ might also be of interest depending on the protocol you need.