Affiliate disclosure
Book titles on this page link to Amazon. As an Amazon Associate, DataField.Dev earns from qualifying purchases — at no additional cost to you.
Further Reading: C-Fortran Interoperability
Interoperability is a corner of the standard where precision pays off, so this list leans on the authoritative references. Sources are tagged Tier 1 (works we are confident exist and recommend) and Tier 2 (real and worth seeking, but confirm the current edition/URL yourself).
The definitive references
- Metcalf, Reid, and Cohen, Modern Fortran Explained (Oxford University Press). Its chapter on
interoperability with C is the clearest authoritative account of
iso_c_binding,bind(c), interoperable types, and the Fortran-2018 descriptor mechanism — the book to reach for when you need the exact rule. Tier 1. - ISO/IEC 1539-1:2018, the Fortran standard, Clause 18 ("Interoperability with C"). The primary source:
what is guaranteed, what is required of an interoperable entity, and how the C
ISO_Fortran_binding.hdescriptor works. Dense, but final. Tier 1. - The GCC /
gfortranmanual, "Mixed-Language Programming" and "Interoperability with C." Documents exactly what your compiler does — the default name mangling (the trailing underscore, the__mod_MOD_scheme), the runtime, andISO_Fortran_binding.h. Tier 1.
Tutorials and the community
fortran-lang.org— the interoperability tutorials and mini-book. Practical, example-driven walkthroughs of calling C from Fortran and Fortran from C, with the compile commands spelled out. The fastest way to get a working first bridge. Tier 1.- Milan Curcic, Modern Fortran: Building Efficient Parallel Applications (Manning). Treats interop in the service of real projects and connects it to the wider modern-Fortran toolchain. Tier 1.
- Stephen Chapman, Fortran for Scientists and Engineers (McGraw-Hill). A gentler, textbook-paced
introduction to
iso_c_bindingif the standard's prose is too terse. Tier 1.
The other side of the bridge
- Kernighan and Ritchie, The C Programming Language (2nd ed., Prentice Hall). To write a correct
interface you must read C prototypes fluently — what
const double *promises, how arrays decay to pointers, how structs are laid out. K&R remains the shortest path to that fluency. Tier 1.
Tools that make the ABI visible
nmandobjdump(GNU binutils). List the symbols in an object file: runnm foo.oand see the mangled__mod_MOD_namebeside the cleanbind(c)symbol. The single most convincing demonstration of whatbind(c)does. Tier 1.- Compiler Explorer (
godbolt.org). Selectgfortran, compile abind(c)procedure, and inspect the emitted symbol and calling convention next to the equivalent C. Invaluable for confirming how an argument is actually passed. Tier 1.
Looking ahead
- The NumPy
f2pydocumentation. The tool of Chapter 15 automates the interface you just learned to write by hand; skimming its docs now shows you what the automation generates — and reveals that it rests on exactly this chapter's C interoperability. Tier 1.
Suggested order
- Do the
fortran-lang.orginterop tutorial end to end — build one working "call C from Fortran" and one "call Fortran from C" before reading further. - Run
nmon your own object files (as in §14.2) to see mangling andbind(c)side by side; it makes the abstract concrete in thirty seconds. - Keep Metcalf/Reid/Cohen open for the exact rules — especially interoperable types and the value/reference constraints — as you write real interfaces.
- Reach for the standard's Clause 18 and
ISO_Fortran_binding.honly when you go beyond the portable core into assumed-shape or allocatable arguments across the boundary.