Is ISO_Fortran_binding.h compatible for different Fortran ABIs?

The C compiler can generate the correct ABI if the corresponding ISO_Fortran_binding.h is used. In case Intel Fortran is correctly setup the include directory of the Intel compilers should be in the CPATH environment variable and therefore prefer the ISO_Fortran_binding.h of Intel Fortran over the GFortran one.

However, you have to be careful about your environment and include paths, if the build of the Fortran and C side are separated, an incorrect ABI could be generated if the wrong header is picked up. It helps to detect some compiler specific extensions from the ISO_Fortran_header.h in your build system to ensure the Fortran and C side actually match.

2 Likes