[fpc-pascal] Data exchange between programs

Dominique Leducq dleducq at magellan-ing.fr
Wed Sep 6 09:29:08 CEST 2006

Matt Emson a écrit :
>> I have 2 FPC programs running on a Linux machine, is there an easy
>> way to exchange a few data between these programs (I do not want to
>> use disk operations). I was thinking of using environment variables,
>> but I cannot find a way to change environment variables from a
>> program.
> MMap? Unix domain sockets? Or do these count as file operations?

IPC SysV message queues or shared memory (depends on what portability 
you need; needs libc linking).
Things are simpler if the processes that need to communicate descend 
from a common ancestor which can setup the communication, allowing 
unnamed pipes, or private IPC SysV resources.

> Isn't there a GetEnv and SetEnv procedure/function somewhere in the 
> LINUX RTL? Libc or somewhere like that?

If you set an environment variable in a process, only the descendent 
processes will inherit and see it, and only the value it has when the 
fork occured, so that's usually not an option.

> HTH,
> M
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

More information about the fpc-pascal mailing list