GNU Info

Info Node: (fftw.info)Calling FFTW from Fortran

(fftw.info)Calling FFTW from Fortran


Next: Installation and Customization Prev: Parallel FFTW Up: Top
Enter node , (file) or (file)node

Calling FFTW from Fortran
*************************

   The standard FFTW libraries include special wrapper functions that
allow Fortran programs to call FFTW subroutines.  This chapter
describes how those functions may be employed to use FFTW from Fortran.
We assume here that the reader is already familiar with the usage of
FFTW in C, as described elsewhere in this manual.

   In general, it is not possible to call C functions directly from
Fortran, due to Fortran's inability to pass arguments by value and also
because Fortran compilers typically expect identifiers to be mangled
somehow for linking.  However, if C functions are written in a special
way, they *are* callable from Fortran, and we have employed this
technique to create Fortran-callable "wrapper" functions around the
main FFTW routines.  These wrapper functions are included in the FFTW
libraries by default, unless a Fortran compiler isn't found on your
system or `--disable-fortran' is included in the `configure' flags.

   As a result, calling FFTW from Fortran requires little more than
appending ``_f77'' to the function names and then linking normally with
the FFTW libraries.  There are a few wrinkles, however, as we shall
discuss below.

Wrapper Routines
FFTW Constants in Fortran
Fortran Examples

automatically generated by info2www version 1.2.2.9