Appendix D: The C/Fortran Interface - Silicon Graphics IRIS Workstation User Manual

Table of Contents

Advertisement

Appendix D: The C/FORTRAN Interface

The FORTRAN 77 compiler on the IRIS Workstation uses a procedure calling
convention that is incompatible with C. To intermix C and FORTRAN
routines, special interface modules (called wrappers) are used to transform calling
sequences. The first section of this appendix outlines the differences between
C and FORTRAN. The second section describes a set of programs and shell
scripts that automate the generation of wrappers. The third section defines the
interface between FORTRAN and the IRIS Graphics Library. The fourth section
contains advice about FORTRAN types. The last section has a brief description
of Hollerith for FORTRAN 77.
D.1 Noteworthy Differences Between C and FORTRAN 77
There are significant differences between the type conventions of C and
FORTRAN 77.
• As described in the IRIS User's Guide, arrays in C are stored in row-
major order (last subscript varies fastest) while FORTRAN stores
them in column-major order.
• Arrays in C are zero-based. Arrays in FORTRAN can have their
subscript base specified, but default to one.
• When an integer expression is passed as a parameter in C, the result
is always a 32-bit object. This is the case with the FORTRAN 77
compiler unless the $INT2 option is used. Using this option, integer
expressions are evaluated into 16-bit objects. Use of the $INT2
option is not recommended when interfacing FORTRAN to C.
• A string (character variable) in FORTRAN 77 has an associated static
length that accompanies it when it is passed as a parameter. Strings
in C are null-terminated to determine the length. There are two
syntax constructs used during wrapper generation that specify how
to pass strings from FORTRAN to C. The first specifies that the
FORTRAN string being passed should be copied and null-terminated.
The second specifies that the wrapper should pass the address of
the (non-null-terminated) FORTRAN string.
• Routine names in C are preceded by an underscore and are of mixed
case and arbitrary length. Routine names in FORTRAN are not
Version 1.0

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the IRIS Workstation and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents