PDA

View Full Version : What is the best way to share data between 2 programs?



ModeZt
27th May 2008, 10:56
Hi all
I have a closed-source program that is collecting data from a scientific measuring device. let's say it's a device driver.
I whant to make an open source user interface for this device.
With this UI i whant to
1) plot the measuring graphs with QWT
so i need to send the measuring data arrays to the UI
2) control the device with some buttons in the UI
so i need to send some info from UI to the driver

How do i implement the applications connections? The driver is going to be pure C/C++ application with a closed source and the UI is going to be a QT application. I don't whant to break GPL license, but i can't show the source of the driver.

jacek
27th May 2008, 16:24
Are these two applications going to be run on the same machine? Is it going to be Unix only system?

If yes, you can take a look at named pipes, FIFOs, Unix domain sockets and shared memory. On windows named pipes and shared memory are available too, but I'm not sure about the rest. You can also consider DBUS (there should be windows port, but I'm sure if windows version of Qt supports it).

Which one to use depends on the protocol you want to use to exchange data. There won't be any problems with GPL, if you are going to have two separate applications that just exchange the data.

Edit: Personally I would consider Unix domain sockets and DBUS (esp. if you can use Qt for the driver as well).

ModeZt
27th May 2008, 21:23
Are these two applications going to be run on the same machine?

yes. they should run on the same machine.


Is it going to be Unix only system?

the first OS will be Linux, but in future the system should work on both windows and unix.


if you can use Qt for the driver as well
i would love to, but i can't open the driver under GPL and i can't pay for the commercial QT.

Thx for the list of possibilities. The problem is that the amount of data is really big. So i see the only way to avoid memory doubling -- Shared Memory.
The driver will then use the OS API for Shared Memory and the UI will use QT implementatnion of Shared Memory.