FFTW 3.3.8: Calling FFTW from Modern Fortran

Next: Calling FFTW from Legacy Fortran, Previous: Distributed-memory FFTW with MPI, Up: Top [Contents][Index]

## 7 Calling FFTW from Modern Fortran

Fortran 2003 standardized ways for Fortran code to call C libraries, and this allows us to support a direct translation of the FFTW C API into Fortran. Compared to the legacy Fortran 77 interface (see Calling FFTW from Legacy Fortran), this direct interface offers many advantages, especially compile-time type-checking and aligned memory allocation. As of this writing, support for these C interoperability features seems widespread, having been implemented in nearly all major Fortran compilers (e.g. GNU, Intel, IBM, Oracle/Solaris, Portland Group, NAG).

This chapter documents that interface. For the most part, since this interface allows Fortran to call the C interface directly, the usage is identical to C translated to Fortran syntax. However, there are a few subtle points such as memory allocation, wisdom, and data types that deserve closer attention.