Silicon Graphics IRIS Workstation User Manual page 80

Table of Contents

Advertisement

76
IRIS WORKSTATION GUIDE
preceded by an underscore, are entirely in upper case, and are a
maximum of six characters. FORTRAN does not allow underscores in
identifiers! This is important to note when porting C routines
written to interface to VAX FORTRAN 77 programs. The VAX
FORTRAN 77 compiler appends an underscore to external function
names it generates to distinguish them from C function entry points.
C routines that expect to be called from the FORTRAN 77 compiler
on the VAX will often have this underscore affixed.
In addition to the problem discussed above with passing strings, there are
differences between the parameter passing conventions of C and FORTRAN 77.
These include:
• a different order of placing parameters on the stack,
• a different set of registers saved across calls,
• whether caller or callee removes the parameters from the stack,
• the FORTRAN 77 limitation to passing parameters by reference
(address). Parameters in C may be passed either by value or by
address.
For the applications programmer, this last difference is the most important.
FORTRAN does not have value parameters. Any time a FORTRAN subroutine
alters one of its parameters, the alteration affects the caller. This may not be
the case when the interface has been modified by a wrapper. Both caller and
callee must agree on that data objects are common.
Wrappers help alleviate these system-level differences by relying on the more
flexible type specifications available in C. By using procedure headers coded in
C, greater semantic meaning can be specified than is possible with FORTRAN
types.
D.2 Generating C/FORTRAN Interface Routines
Assembly-language wrapper files are generated by giving a copy of a C
function to one of the programs mkf2c or mkc2f. Both programs use C type
declarations for the parameters to generate the correct assembly-language
interface. To generate a FORTRAN entry point for an existing C function, the
function is simply passed through mkf2c. To generate a C entry point for an
existing FORTRAN routine, the FORTRAN routine declaration and parameter
list must be coded as if it were a C function and passed through mkc2f.
Each function given to mkf2c or mkc2f must have the standard C function syntax.
The function body must exist but may be empty. Function names will be
transformed as necessary in the output.
The simplest case of a function used as input to mkf2c or mkc2f would be
Appendix D:
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?

Table of Contents