When a procedure is called, Fortran (by default) passes the address of the actual argument, and its length if it is of type character. To call non-Fortran procedures, you may need to pass the actual arguments in a form different from that used by Fortran.
The built-in functions %DESCR, %REF, and %VAL let you change the form of an actual argument. You must specify these functions in the actual argument list of a CALL statement or function reference. You cannot use them in any other context.
These functions specify how to pass an actual argument (for example, a) to a non-Fortran procedure, as follows:
| Function | Effect |
|---|---|
| %VAL (a) | Passes argument a as an n-bit [1] immediate value. If a is integer (or logical) and shorter than n bits, it is sign-extended to an n-bit value. For complex data types, %VAL passes two n-bit arguments. |
| %REF (a) | Passes argument a by reference. |
| %DESCR (a) | Passes argument a by descriptor. [2] (VMS only) |
|
[1] n is 64 on Alpha processors; 32 on Intel
processors.
| |
Table 8-1 lists the DIGITAL Fortran defaults for argument passing, and the
allowed uses of %DESCR, %REF, and %VAL.
Table 8-1 Defaults for Argument List
Functions
| Allowed Functions | ||||
|---|---|---|---|---|
| Actual Argument Data Type | Default | %VAL | %REF | %DESCR [1] |
| Expressions: | ||||
| Logical | REF | Yes[2] | Yes | Yes |
| Integer | REF | Yes[2] | Yes | Yes |
| REAL(4) | REF | Yes | Yes | Yes |
| REAL(8) | REF | Yes[3] | Yes | Yes |
| REAL(16)[4] | REF | No | Yes | Yes |
| COMPLEX(4) | REF | No | Yes | Yes |
| COMPLEX(8) | REF | No | Yes | Yes |
| Character | DESCR[1,5] | No | Yes | Yes |
| Hollerith | REF | No | No | No |
| Aggregate[6] | REF | No | Yes | No |
| Derived | REF | No | Yes | No |
| Array Name: | ||||
| Numeric | REF | No | Yes | Yes |
| Character | DESCR[1,5] | No | Yes | Yes |
| Aggregate[6] | REF | No | Yes | No |
| Derived | REF | No | Yes | No |
| Procedure Name: | ||||
| Numeric | REF | No | Yes | Yes |
| Character | DESCR[1,5] | No | Yes | Yes |
|
[1] VMS only
| ||||
For details on how to use the %VAL, %REF, and %DESCR functions, see your user manual or programmer's guide.