Integrating Zorro processes

Multiple Zorro processes can be started, stopped, and controlled either from a 'master' Zorro instance (Zorro S only), or from an external 32-bit or 64-bit Zorro DLL. In this way Zorro can be integrated in other trading platforms or software tools. All processes can exchange arbitrary information with each other and with the DLL or master instance. For licensing the Zorro DLL please contact info@opgroup.de. Further individual DLL functions can be implemented on request.

The following standard functions are supported by the Zorro DLL and by Zorro scripts:

zInit (int Num, int Size): int

Initializes the interprocess communication. Must be called from the Zorro DLL and all other Zorro processes.

zOpen (int Id, const char* Commandline): int

Starts a Zorro process with the given command line. Must be called from the DLL or master process. Returns the process handle, or 0 when no process was started.

zStatus (int Id): int

Returns 1 when the process is still running, 0 otherwise. Must be called from the DLL or master process. 

zClose (int Id)

Closes the Zorro process with the given Id. Id == 0 closes all Zorro processes. Must be called from the DLL or master process.

zData (int Id): void*

Returns a pointer to a data area of the previously given Size for exchanging information with the Zorro process with the given Id. For the data area, a byte-aligned struct can be defined that contains the variables to be exchanged (see example). 

Parameters:

Num Total number of processes to handle, 2..72.
Size Size of the data area in bytes. 8 bytes per var, 4 bytes per int.
Id Process identifier number, 2..Num, or 1 for the master process.
Commandline Command line parameters for the Zorro process. If no script name is given, the current script is used.

Returns:

Nonzero when successful, 0 otherwise.

Remarks:

Example (see also the Process.c script):

typedef struct INFO { 
  var Position; 
} INFO;

INFO *Own, *Other;

void main()
{
  if(!zInit(2,4)) {
    printf("Can't initialize process!"); 
    return;
  } 

  if(Core <= 1) zOpen(2,"-w 320");
  Own = zData(Core);
  Other = zData(3-Core); // Core is 1 or 2

  slider(1,1,1,100,"This",0);
  slider(2,1,1,100,"Other",0);
  while(wait(1)) {
    slider(1,Own->Position);
    Other->Position = slider(2);
  }
  zClose(2);
}

See also:

Licenses, Core, command line ► latest version onlin