Programmer Guide > Creating an OPI Option > Managing Options
  

Managing Options
The following PV‑WAVE routines are used to explicitly manage Options developed with OPI.
*LOAD_OPTION—Explicitly loads a module created as an Option to PV‑WAVE.
*UNLOAD_OPTION—Explicitly unloads an Option module.
*SHOW_OPTIONS—Lists the loaded Options and their associated functions and procedures.
Loading and Unloading an Option
Assume that you have created a simple Option module that contains the functions:
*PLUS_TWO
*PLUS_THREE
and the procedures:
*ADD_TWO
*ADD_THREE
*ADD_FOUR
The Option is called SAMPLE, and this is the version 1.0 of SAMPLE.
In PV‑WAVE, the functions and procedures of SAMPLE are not yet available, because the Option has not yet been loaded. As expected, the SHOW_OPTIONS procedure returns nothing:
WAVE> SHOW_OPTIONS, /Function, /Procedure
WAVE>
However, once you load the SAMPLE module, the functions are available. Here, the LOAD_OPTION procedure is used to explicitly load the Option SAMPLE, and now the SHOW_OPTIONS procedure returns a list of the functions and procedures of SAMPLE:
WAVE> LOAD_OPTION, 'SAMPLE'
WAVE> SHOW_OPTIONS, /Function, /Procedure
% Option: SAMPLE 1.000000
% Functions:
% PLUS_THREE
% PLUS_TWO
% Procedures:
% ADD_FOUR
% ADD_THREE
% ADD_TWO
The functions and procedures of SAMPLE are ready for use at the command line:
WAVE> p = 10
WAVE> ADD_THREE, p
WAVE> PRINT, p, PLUS_THREE(p)
13 16
Now, the UNLOAD_OPTION procedure is used to unload SAMPLE. When this is done, the functions and procedures of SAMPLE are no longer available at the command line:
WAVE> UNLOAD_OPTION, 'SAMPLE'
WAVE> PRINT, PLUS_THREE(p)
% Variable is undefined: PLUS_THREE.
% Execution halted at $MAIN$ .
As you can see, the user has control over when the Option is loaded and unloaded. For detailed information on the routines LOAD_OPTION, UNLOAD_OPTION, and SHOW_OPTIONS, see the PV‑WAVE Reference.

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.