Clicky

Fortran Wiki
Interoperability

Fortran interoperability is possible with many other languages.

C

Fortran 2003 provides standardized support for C interoperability.

See c_interface_module for an example of using type aliases to produce better-defined C interface prototypes.

Code::Blocks IDE plugin FortranProject has a BindTo tool which generates interfacing code to call Fortran from C.

Generating C Interfaces

C++

See Cpp interoperability

C#

See CSharp Interoperability.

Lua

Lua is a highly portable scripting language, suitable for inclusion in host programs. It is widely used for configuration files, and to this end is also useful for Fortran applications, a wrapper library called Aotus is available for this purpose.

Matlab

See Matlab

Octave

See OctaveFortran on the Octave wiki.

OpenCL

A language that allows to write parallel code for massively parallel processors like graphical processing units (GPUs), accelerator boards and multi-core CPUs. OpenCL is based on a C library, but you can run OpenCL code directly from Fortran with the FortranCL library.

Python

See Python.

R

See R

Ruby

fortio-namelist - Ruby library for reading and writing data in Fortran’s namelist format, by Himo Toyoshi

Tcl

See Tcl.

Julia

See Calling C and Fortran code in the Julia documentation

Compilation or translation from Fortran to other languages

Several programs compile or translate Fortran code to other languages:

Fortran to C

f2c This is still widely distributed and multiple versions have been developed.

fwrap wraps Fortran code in C, Cython and Python.

promulaFortran A commercial program.

Fortran to C++

f2cpp

F2C++

Fable

Fortran to Java

f2j

Fortran to Lisp

f2cl

Fortran to Python

f2py: Fortran to Python interface generator.

f90wrap is a tool to automatically generate Python extension modules which interface to Fortran code that makes use of derived types.

Code::Blocks IDE plugin FortranProject has a BindTo tool which generates interfacing code to call Fortran from C, Cython and Python.

fwrap wraps Fortran code in C, Cython and Python.