Choosing the Best Method
It is important to select the most appropriate method of interapplication communication for your 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. SPAWN is described in the previous chapter.
*I want my C program to link 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 PV-WAVE system procedure that calls a function in a Dynamic Link Library (DLL). 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 wavevars see "Accessing Data in PV‑WAVE Variables".
 
note
See also the section "Using the Option Programming Interface". The Option Programming Interface (OPI) functions allow user-written C 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 dynamically linked with PV-WAVE.
The cwavec function allows a dynamically 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 dynamically linked FORTRAN program to access PV-WAVE’s data space.
For information on cwavec see "Calling PV‑WAVE as a Dynamically Linked Program". For information on the data transfer function wavevars see "Accessing Data in PV‑WAVE Variables". The cwavefor routine is discussed in the section "cwavefor: Calling PV‑WAVE from a FORTRAN Program".