[CMake] Issue with Fortran/C binding with Intel compilers

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Nov 17 14:21:26 EST 2016


On 2016-11-17 11:12-0400 Joachim Pouderoux wrote:

> Unfortunately I can't (Fortran95 only), that's why CMake feature is
> important.

Hi Joachim:

I have helped convert two projects (PLplot and the ephcom subproject
of timeephem) recently to use the iso_c_binding module provided by
Fortran 2003, and that approach (at least for providing a Fortran
binding to a C library since we have had no need for a C binding to a
Fortran library) is absolutely great and works fine with fairly recent
versions of the Intel compiler, the gfortran compiler, and likely most
importantly from our point of view, the NAG compiler (which advertises
itself as being the Fortran compiler that is most demanding concerning
compliance with Fortran standards).

So my advice is to go ahead and at least experimentally provide the
option of using the iso_c_binding module to future-proof your work,
and once that new interfacing works I would push (assuming Fortran95
only is a committee decision) to make an exception for at least the
iso_c_binding module so you don't have to maintain some home-brew
C/fortran interface forever.

>From my recent very positive experience with the iso_c_binding module,
the only reason not to go with that module for C/Fortran interfacing
needs is if if it doesn't work for those needs (which is not my
experience for a Fortran binding to a C API in the PLplot case with a
large variety of types of C calls including callbacks) or if there is
a Fortran compiler out there that does not support it.  I haven't
found such a compiler yet, but my search has only involved the 3
compilers referred to above so obviously has not been exhaustive. Is
there some Fortran compiler you are aware of (aside from really old
versions of any of them) that does not provide a working iso_c_binding
module?  And if such a beast exists that does not even support this
important part of Fortran 2003, do you want to cater to this beast
indefinitely?  After all, 2003 is quite a few years ago so if a compiler
doesn't support that, it is almost by definition unsupported.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list