Choosing the Best Method
It is important to select the most appropriate method of interapplication communication for your particular needs. Choosing the wrong method often requires much more work than is necessary to accomplish a given task.
This section describes typical scenarios where some kind of interapplication communication is required. After each scenario is described (in italics), a suitable solution for interapplication communication is suggested.
*I’m running PV-WAVE, and I want to execute an external program I’ve written. I’m not really concerned about returning anything to PV-WAVE.
This is the simplest case of interapplication communication. The SPAWN procedure is the best choice. SPAWN executes an external program, or an operating system command, from PV‑WAVE. (Although it is not a requirement in this scenario, SPAWN can return data from the external application to PV‑WAVE.)
For information on using SPAWN, see "Interapplication Communication Using SPAWN".
*I’m on a UNIX system, and I want to call PV-WAVE from my C or FORTRAN program, execute some PV-WAVE commands, and exit PV-WAVE. It isn’t necessary for my program to retrieve any data from PV-WAVE.
The routines waveinit, wavecmd, and waveterm can be used to accomplish this sort of task. These routines, which are only available under UNIX, allow one-way (unidirectional) communication from a C or FORTRAN application to PV‑WAVE. They start PV‑WAVE, execute specified commands, and exit PV‑WAVE. No data is transferred back to the calling program.
For information on using waveinit, wavecmd, and waveterm, see "Executing PV‑WAVE Commands Externally".
*I wrote a C program, and I want to be able to link it dynamically with PV-WAVE. My program needs to be able to access data directly from the data space of PV-WAVE. When my program is finished running, I want control returned back to PV-WAVE.
The LINKNLOAD procedure is the simplest method for attaching your own code to PV‑WAVE. LINKNLOAD is a system procedure that calls a function in an external sharable object. When used in conjunction with the wavevars function, data can be passed back and forth between the user-written routine and PV‑WAVE.
For information on LINKNLOAD, see "Using LINKNLOAD to Call External Programs". For information on the data transfer function wavevars see "Using wavevars() to Access PV-WAVE Variables".
 
note
See also the section "Method 2: The Option Programming Interface". The Option Programming Interface (OPI) functions allow user-written code to access PV‑WAVE variables and use other PV‑WAVE functionality. OPI provides greater flexibility and control than wavevars.
*I want to be able to call PV-WAVE from a C or FORTRAN program I’ve written. I want the program to be statically linked with PV-WAVE.
The cwavec function allows a statically linked C program to access PV‑WAVE’s data space. Data is transferred between the C program and PV‑WAVE via the wavevars routine. In addition, the cwavefor function allows a statically linked FORTRAN program to access PV‑WAVE’s data space.
For information on cwavec and cwavefor see "Calling PV-WAVE in a Statically Linked Program". For information on the data transfer function wavevars see "Using wavevars() to Access PV-WAVE Variables".
*I have an application running across the UNIX network that I want my PV-WAVE program to communicate with.
Under UNIX, Remote Procedure Calls (RPCs) can be used to facilitate this kind of communication.
For information on interapplication communication routines that support RPCs, see "Remote Procedure Call Examples".