Type mismatch in argument ‘prp_id’ at (1); passed INTEGER(4) to INTEGER(8)


#1

Hi All,

I am getting this error from a test program that I am trying to compile. I have tried all permutations and combinations of the INTEGER sizes to no avail. Can anyone help me with this?

program conftest
use hdf5
implicit none
integer(4) :: classtype
integer(4) :: comm
integer(hid_t) :: plist_id
integer(4) :: hdferr
call h5pset_fapl_mpio_f(classtype,plist_id,comm,hdferr)
end program conftest
Error:
Type mismatch in argument ‘prp_id’ at (1); passed INTEGER(4) to INTEGER(8)

Thank you.

With best regards,
Satish Kamath


#2

I think you may have picked up the wrong function prototype. Your args do not match up. I did not check the on-line docs, but this is what I found in the HDF5 1.13.0 source code for src/H5Pff.F90:

  SUBROUTINE h5pset_fapl_mpio_f(prp_id, comm, info, hdferr)
    IMPLICIT NONE
    INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier
    INTEGER, INTENT(IN) :: comm ! MPI communicator to be used for file open
                                ! as defined in MPI_FILE_OPEN of MPI-2
    INTEGER, INTENT(IN) :: info ! MPI info object to be used for file open
                                ! as defined in MPI_FILE_OPEN of MPI-2
    INTEGER, INTENT(OUT) :: hdferr ! Error code

Also please note, it is bad practice to use explicit numeric kind values in modern fortran. They can change between compilers. Use generic integer routinely, or symbolic kinds such as integer(hid_t) when necessary.

Symbolic kind values are out of scope for this topic, but can be researched on line or in the fortran spec. Unfortunately there are a lot of bad examples out there, doing it the wrong way.