Parameter Passing Mechanism
Parameters are passed to IDL system and user-written procedures and functions by value or by reference. It is important to recognize the distinction between these two methods.
Parameters passed by value can only be inputs to program units. Results cannot be passed back to the caller by these parameters. Parameters passed by reference can convey information in either or both directions. For example, consider the following trivial procedure:
This procedure adds its second parameter to the first, returning the result in the first. The call
adds 4 to A and stores the result in variable A. The first parameter is passed by reference and the second parameter, a constant, is passed by value.
The following call does nothing because a value cannot be stored in the constant 4, which was passed by value.
No error message is issued. Similarly, if ARR is an array, the call
will not achieve the desired effect (adding 4 to element ARR[5]), because subscripted variables are passed by value. The correct, though somewhat awkward, method is as follows:
Note
IDL structures behave in two distinct ways. Entire structures are passed by reference, but individual structure fields are passed by value. See Parameter Passing with Structures for additional details.