[CMake] FORTRAN name mangling

Zaak Beekman zbeekman at gmail.com
Mon Jan 11 14:31:25 EST 2016


> So if I require Fortran 2003 for our fortran codes then this whole
> ?fortran name-mangling? thing becomes a moot point, i.e. I do not have to
> actually worry about it at all for our project. Just have to keep the C
> header consistent with the FORTRAN functions, but that part is on our devs.
>

Exactly, that is the whole point of the standardized `ISO_C_BINDING` module
and C interop being added to the Fortran 2003 standard. No more ugly guess
work, hackery, etc.

AFAIK, there is pretty good support for this among compiler vendors, so
long as you have a recent release. I know for sure GCC's gfortran and
Intel's ifort support this very well. I'm pretty sure PGI, Cray and IBM
support it too. I have never used NAG, so I withhold comment there, but I'd
be surprised if they had yet to add this to their compiler. The demand for
C interop is really high, and almost all of these companies make companion
C compilers, so, in my experience, they have been relatively quick to
implement these features, while some other Fortran 2003 and later features
have languished. (I'm looking at you, parameterized derived types...)

Happy hacking!

P.S. Unless you want to sound like an old geezer, it's spelled Fortran
these days, not FORTRAN. ;-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160111/082d9c2f/attachment.html>


More information about the CMake mailing list