Buy the book!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
A simple and foolproof way to write
g77-callable C routines--e.g. to
interface with an existing library--is to write a file (named, for
example, `fred.f') of dummy Fortran
skeletons comprising just the declaration of the routine(s) and dummy
f2c on file `fred.f' to produce `fred.c'
into which you can edit
useful code, confident the calling sequence is correct, at least.
(There are some errors otherwise commonly made in generating C
such as not using
as the return type of a
f2c also can help with calling Fortran from C, using its
`-P' option to generate C prototypes appropriate for calling the
If the Fortran code containing any
routines to be called from C is in file `joe.f', use the command
f2c -P joe.f to generate the file `joe.P' containing
#include this in the C which has to call
the Fortran routines to make sure you get it right.
See section Arrays (DIMENSION), for information on the differences
between the way Fortran (including compilers like
C handle arrays.
|webmaster||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|