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. Is it possible for QSharedMemory shared between QT Application and External process (non-qt)?

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

Scheduled Pinned Locked Moved General and Desktop
qt5qsharedmemoryexternal proces
2 Posts 2 Posters 1.1k 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.
  • A Offline
    A Offline
    Anshul
    wrote on 25 Jun 2015, 17:19 last edited by
    #1

    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

    T 1 Reply Last reply 25 Jun 2015, 18:05
    0
    • A Anshul
      25 Jun 2015, 17:19

      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

      T Offline
      T Offline
      t3685
      wrote on 25 Jun 2015, 18:05 last edited by
      #2

      @Anshul

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

      1 Reply Last reply
      0

      2/2

      25 Jun 2015, 18:05

      • Login

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