This document tells a programmer how to mix program segments written in FORTRAN and C in a portable way. It provides information on several levels from a quick “how to get started” cookbook, down to machine-specific details. The cookbook will tell you how to write programs, but without much of the background information of what is really going on. After you have tried a few programs, you will probably want to read the rest of the document.
Before you embark upon mixed language programming, it may be worth reading the Rationale for mixed language programming in Appendix B which discusses the problems and offers some alternatives.
The current system is supported for Sun systems running Solaris, DEC Alphas running OSF/1, and PC’s running Linux but in the past has run successfully on SunOS, Ultrix and VAX/VMS. Reference is made to the VAX/VMS system in this document as it is in many respects very different from the Unix systems and so provides a useful comparison. You should consult the VMS Starlink documentation set about the VAX/VMS version however, as not all the facilities described here are available in it, even if a VAX/VMS example is given.
Full descriptions of the C macros and functions involved are
provided in appendices E and G. The macro names in the text will often include the legend type
to
indicate a generic macro name. In this case, type
may normally be one of INTEGER
, REAL
, DOUBLE
,
LOGICAL
or CHARACTER
. Types BYTE
and WORD
and their unsigned versions UBYTE
and UWORD
are also
available but do not correspond to standard FORTRAN types so should be avoided. type
may also be
POINTER
– again this is not a standard FORTRAN type but it is more commonly used in Starlink
software (see Section 7).
For consistency with other Starlink libraries the CNF function names were changed (at Version 4.0)
from the form cnf_name
to the form cnfName
. The old names are still permitted via macros defined in
the f77.h
header file.
There is also a section (13) on how to compile and link the programs.