Guide to Interfacing C and FORTRAN 77

There are—if one permits the understatement—a lot of libraries written in FORTRAN 77 (and FORTRAN 90 as well). And whilst Fortran 2003 readily provides easy ways of interfacing Fortran with C (the ISO_C_BINDING module, to be clear), FORTRAN 77 (and also FORTRAN 90) do not and require more “work” (or if one wish to be more accurate: “hacky nonsense”). This guide will endeavour to be a useful—hopefully, the author makes no promises—resource on the esoteric “art” of interfacing the two languages.

Table of Contents

  1. Introduction
    1. The Programming Environment
    2. Example Makefile
  2. Data Types and Passing Data
    1. Data Types
      1. A Note on Complex Types
      2. A Note on Floating Point Formats
        1. Single (32-bit) and Double (64-bit) Precision Types
          • VAX F-Float, D-Float, and G-Float
          • IBM HFP Short and Long
        2. Extended (80-bit) Precision Types
        3. Quadruple (128-bit) Precision Types
          • VAX H-FLoat
          • IBM 128-bit Float
        4. Half (16-bit) Precision Types
      3. C's char and Other C Primitives
    2. Compound Data Structures
      1. The COMMON Block and C structs
      2. The VAX FORTRAN STRUCTURE Extension and C structs
      3. The VAX FORTRAN UNION Extensions and C unions
    3. Arrays
  3. Function/Subroutine Calls
    1. C Function Prototypes for FORTRAN Callable Functions/Subroutines
    2. C Functions Calling FORTRAN Functions
    3. FORTRAN Functions Calling C Functions
  4. License Details


Valid XHTML 1.0 Strict Valid CSS!
Fave icon Database CMYK © 2008 – Barry Mieny
Syntax highlighting using highlight.js by © 2006 – Ivan Sagalaev