FORTRAN Reference Manual

Mixed-Language Programming
FORTRAN Reference Manual528615-001
13-7
The FORTRAN Calling Sequence
the TAL object file includes:
Common data block “$BIG” in the extended data segment
Common data block “BIG” in the global primary data area, containing doubleword
pointers to A and B
Common data block “.SMALL” in the user data segment
Common data block “SMALL” in the global primary data area, containing pointers
to C, D, and E
The layout of blocks “$BIG” and “.SMALL” will be the same as those of the FORTRAN
program.
When Binder combines these two object files, procedures in each object file can
reference the variables in the two common data blocks safely, because they have
equivalent declarations.
Note that each FORTRAN simple variable in a common block must be declared in TAL
as a one-element array, so that TAL creates a pointer in the pointer block and the
variable itself in the data block that corresponds to the FORTRAN common block, in
order to achieve the desired equivalency of declarations.
The FORTRAN Calling Sequence
This subsection explains how FORTRAN generates object code to invoke
subprograms that are not declared in GUARDIAN or CONSULT compiler directives
and, thus, are assumed to be written in FORTRAN. The caller of a FORTRAN
subprogram must set up the stack according to the conventions used by FORTRAN,
regardless of the language in which the caller is written.
If you do not specify a GUARDIAN or CONSULT directive, FORTRAN does not know
the calling sequence of the subprogram. It determines the calling sequence based on
the actual arguments you pass to the routine. That is, the FORTRAN compiler cannot
examine an object file containing the called procedure, or a source file containing its
declaration.
Passing Parameters
Suppose a FORTRAN program includes the type declarations:
INTEGER*2 holmes, watson
REAL doyle
CHARACTER*6 conan
CHARACTER*7 mycroft
CHARACTER*8 sherlock
CHARACTER*9 moriarity