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
Summary of Contents for IRIS Workstation
Page 1: ...IRIS Workstation Guide Version 1 0 Silicon Graphics Inc Mountain View California 94043 ...
Page 6: ...2 IRIS WORKSTATION GUIDE Version 1 0 Introduction ...
Page 24: ...20 IRIS WORKSTATION GUIDE Version 1 0 Hardware Installation ...
Page 30: ...26 IRIS WORKSTATION GUIDE Version 1 0 Operation ...
Page 48: ...44 IRIS WORKSTATION GUIDE Version 1 0 System Administration ...
Page 50: ...46 IRIS WORKSTATION GUIDE Version 1 0 Appendix A ...
Page 74: ...70 IRIS WORKSTATION GUIDE Version 1 0 Appendix B ...
Page 77: ...Version 1 0 IRIS WORKSTATION GUIDE 73 Appendix C e random gr error f wnrepaint ...
Page 78: ...74 IRIS WORKSTATION GUIDE Version 1 0 Appendix C ...
Page 92: ...88 IRIS WORKSTATION GUIDE Version 1 0 Appendix D ...
Page 102: ...98 IRIS WORKSTATION GUIDE Version 1 0 Appendix E ...
Page 103: ...Appendix F Manual Pages ...
Page 104: ......
Page 131: ...Version 1 0 126 IRIS WORKSTATION GUIDE Appendix F ...
Page 132: ......
Page 136: ...130 IRIS WORKSTATION GUIDE Version 1 0 Appendix H ...
Page 152: ...146 IRIS WORKSTATION GUIDE Version 1 0 Appendix J ...