I have a C++ (technically MATLAB mex) program, which I am planning to use to launch a stand-alone pure C++ slave program on my system. The master calling program may look something like the following:
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[]){
system ("path/to/slave/program");
}
Once the slave is launched, I would then like to have a second mex program which will communicate with and send data to the slave program. The data sent will be in the form of large-ish C++ arrays.
I imagine that I will need some kind of handle to the slave program (perhaps its pid?), a method for sending messages and presuamably a way for the slave program to listen out for incoming messages.
I have no experience in getting separate C++ programs to communicate with each other, so any hints in this area would be appreciated. In addition, if there are any specific MATLAB mex-specific caveats, I would be interested to hear about these.
EDIT: I should have mentioned that I am building this on Ubuntu, but will ultimately like it to work on all platforms. Platform specific advice very welcome, but multi-platform ideas are really what I'm after.