Important: Please read the Qt Code of Conduct -

Is it possible for QSharedMemory shared between QT Application and External process (non-qt)?

  • I'm a QT newbie so apologies for missing anything basic. I have a QApplication that calls an external executable (it's a simple c++ code that's running as an executable that has a while loop). This executable will be launched by QProcess and will keep running infinitely, passing data to this QApplication through stdout, unless it's (the external process is) manually exited from by the user who running it from console. This process does not wait for stdin while it is running.

    I also want the QT application to talk back to the executable, through some means other than stdin. I want to be able to modify this executable's behavior at runtime by being able to send some form of signal (not to be confused by qt's signal/slot) from the QApplication to the external process. I read about QT's IPC and I think QSharedMemory is the easiest way to achieve this. I cannot use any kind of pipes etc since the process is not waiting for stdin. (Although I can modify the executable's code, I prefer trying some form of communication other than, say, pipes).

    Is it possible for there to be a QSharedMemory that is shared by the QApplication as a well as a process running externally that is not a QT application. If yes, are there any example someone can point me to; I tried to find some but couldn't. If not, what other options might work in my specific scenario?

    Thanks in advance

  • @Anshul

    According to the documentation, yes. How to access this memory segment from the other non-Qt process is OS specific.