I am working on a complicated fortran code, which uses MPI and calls FFTW3 functions directly.
As FFTW3 manual pdf file says, the integer is replaced by integer(c_intptr_t), the complex becomes complex(c_double_complex). What's the difference between integer type and integer(c_intptr_t) type data (also the difference between complex and complex(c_double_complex) )? Whether I can use integer(c_intptr_t) the same as integer, or vice versa? Moreover, can I pass values to each other?
integer :: a
integer(c_intptr_t) :: b
What's the value and type of b now?
In general, pointers and integers are different kinds of integers and should not be mixed. The distinctions may be based on storage size (i.e., 4, 8, etc. bytes), signed/unsigned (from the C point of view) and the restrictions on what can be done with/to pointers versus integers. The C_INTPTR_T of Fortran is the same as the intptr_t type of C.
Here is a small test program that you can run in your environment to establish storage sizes.
program tst use iso_c_binding integer :: i4 integer(8) :: i8 integer(c_intptr_t) :: ix ! write(*,*)sizeof(i4),sizeof(i8),sizeof(ix) end program