[SOLVED] Best way to call external functions from a different process
-
Hello,
I created a basic Qt UI that has buttons. I have an external application that I created in C++ from MSVS2008. I am using QSharedMemory for IPC communication. I have successfully binded the data from my app to the UI and can read the outputs. I am a little bit stuck as to what the best way would be to communicate back to my external application. For example, how would I call a function in my external app once a button is pressed in my GUI?
Thanks ahead of time!
-
Hi,
Using QSharedMemory for that, I can only see some kind of protocol you have to setup between your two processes. Something like command + input values that you other process would parse and act upon.
If you need something more complex you might want to try the other IPC classes like QLocalSocket/Server.
There is also Qxt that offers class to communicate signals/slots between two process.
Hope it helps
-
[quote author="SGaist" date="1370355322"]Hi,
Using QSharedMemory for that, I can only see some kind of protocol you have to setup between your two processes. Something like command + input values that you other process would parse and act upon.
If you need something more complex you might want to try the other IPC classes like QLocalSocket/Server.
There is also Qxt that offers class to communicate signals/slots between two process.
Hope it helps[/quote]
Should I used two differenct shared memory spaces (1 for input data and 1 for output data) or would it be fine to just use one section of shared memory that I store all my data in?
-
The answer is yes.
Under many scenarios, one QSharedMemory would be fine: in others, you may need two (or more). It all depends on the size, content, protection requirements, etc. of your particular implementation.
What you have asked is a design question: without knowing all the requirements any answer I might give you would just be a guess.