FORTRAN Reference Manual

Mixed-Language Programming
FORTRAN Reference Manual528615-001
13-15
Calling Routines Without Using GUARDIAN and
CONSULT Directives
(LARGEDATA ERROR), you cannot pass its address to the FILEINFO procedure. The
example passes ERROR_TEMP, which is allocated in the user data segment, instead,
and then assigns the value returned in ERROR_TEMP to ERROR.
The Guardian Procedure Calls Reference Manual indicates which procedures expect
word addresses and which expect doubleword addresses. Parameters that specify
.EXT in their description expect doubleword addresses.
This restriction does not apply to arguments passed by value. You can use formal
parameters and data items stored in extended memory as pass-by-value arguments in
Guardian procedure calls.
Calling Routines Without Using GUARDIAN and CONSULT
Directives
You can call subprograms that are not written in FORTRAN from FORTRAN without
declaring them in GUARDIAN or CONSULT directives, but this requires a different
syntax that is more difficult to use and this method usually causes many “parameter
mismatch” and related warning messages from the Binder.
If you write a FORTRAN program that calls a procedure that are not written in
FORTRAN and you do not specify a GUARDIAN or CONSULT directive, you must
observe the following rules:
A procedure that can be called as a function must be called as a function from
FORTRAN.
All parameters are required, even if you call a VARIABLE or EXTENSIBLE
procedure. See below for more information on optional parameters.
The order of all parameters must match.
The number of parameter words passed by FORTRAN must match the number of
words expected by the called procedure.
In general, this means that the parameters must match in number and type, and
that you must supply parameters of a FORTRAN type that matches the type
expected by the called procedure. For example, if the called procedure is written in
TAL and expects a parameter that is declared INT(32), you must supply a
FORTRAN argument that is declared INTEGER*4.
Note. Calling routines that are not written in FORTRAN without specifying them in a
GUARDIAN or CONSULT directive was an HP FORTRAN feature before either the GUARDIAN
or the CONSULT directives was supported. New FORTRAN code—and existing code that you
modify—should specify external routines using either the GUARDIAN directive or the
CONSULT directive. Existing programs that use the old form for procedure calls that are not
written in FORTRAN will continue to compile and execute correctly unless you modify the
programs in certain ways. For details, see Compatibility With the Old Form of Procedure Calls
Not Written in FORTRAN on page 13-22.