To call non-Fortran subprograms, you may need to pass the actual arguments in a form different from that used by Fortran.
The %VAL, %DESCR (VMS only), and %REF built-in functions allow you to 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 built-in functions specify how to pass an actual argument (for example, a) to a subprogram, as follows:
Function | Effect |
%VAL (a) | Pass argument a as a 32-bit immediate value. (If a is shorter than 32 bits, it is sign-extended to a 32-bit value.) On Alpha processors, a can be a 64-bit value. |
%REF (a) | Pass argument a by reference. |
%DESCR (a) | Pass argument a by descriptor. (VMS only) |
Table 6-1 lists the Compaq Fortran 77
defaults for argument-passing, and the allowed uses of %VAL, %REF,
and %DESCR.
[1] VMS only
Table 6-1 Argument List Built-In Functions and
Defaults
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*8
REF No Yes
Yes
COMPLEX*16
REF No Yes
Yes Character
DESCR[1,5] No Yes
Yes Hollerith
REF No No
No Aggregate
REF No Yes
No Array Name
Numeric REF
No Yes Yes
Character DESCR[1,5]
No Yes Yes Aggregate
REF No
Yes No Procedure
Name
Numeric REF
No Yes Yes
Character DESCR[1,5] No
Yes Yes
[2] If a logical or integer value occupies less than 32 bits
of storage, it is converted to a 32-bit value by sign extension. Use
the ZEXT function if zero extension is desired.
[3] Alpha only
[4] VMS, U*X
[5] On Tru64 UNIX systems, character is passed by address
and hidden length. (For more information, see your user manual.)
For details on argument-passing mechanisms, see your user manual.