Next: , Previous: Reversing array dimensions, Up: Calling FFTW from Modern Fortran

7.3 FFTW Fortran type reference

The following are the most important type correspondences between the C interface and Fortran:

You may be wondering if you need to search-and-replace real(kind(0.0d0)) (or whatever your favorite Fortran spelling of “double precision” is) with real(C_DOUBLE) everywhere in your program, and similarly for complex and integer types. The answer is no; you can still use your existing types. As long as these types match their C counterparts, things should work without a hitch. The worst that can happen, e.g. in the (unlikely) event of a system where real(kind(0.0d0)) is different from real(C_DOUBLE), is that the compiler will give you a type-mismatch error. That is, if you don't use the iso_c_binding kinds you need to accept at least the theoretical possibility of having to change your code in response to compiler errors on some future machine, but you don't need to worry about silently compiling incorrect code that yields runtime errors.