[CMake] FORTRAN name mangling

Damian Rouson damian at sourceryinstitute.org
Mon Jan 11 14:57:56 EST 2016


> On Jan 11, 2016, at 11:31 AM, Zaak Beekman <zbeekman at gmail.com> wrote:
> 
> 
> 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.

Even as far back as about five years ago, all 10 compilers surveyed by Ian Chivers and Jane Sleightholme supported C interoperability.  And now there are at least four compilers that even support the _additional_ C interoperability features in the draft Fortran 2015 standard: the IBM, Cray, Intel, and GNU compilers.  C interoperability appears to be one of the first things every compiler team tackles from a new standard.

Anyone with access to ACM Fortran Forum will benefit from consulting the standards-support survey that Ian and Jane have published in almost every issue for roughly a decade or so.  Standards support in  Fortran compilers is not quite where it needs to be, but it’s much better than it was even just a couple of years ago. Great strides have been taken.

> 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…)

PDT is one of the few Fortran 2003 features for which support is still a bit limited, but it is supported by at lest four compilers: IBM, Cray, Intel, and Portland Group, all of which are fully Fortran 2003 compliant.  I would bet that NAG will have it soon and GNU will likely have it in their development branch sometime later this year.  A developer has already put a great deal of work into scoping out the effort.  PDTs are a monster to implement in a compiler.

> 
> P.S. Unless you want to sound like an old geezer, it's spelled Fortran these days, not FORTRAN. ;-)

And the standard has spelled it in mixed case at least since Fortran 90 so, in addition to being dated, spelling FORTRAN in all-caps is non-standard. 

:D

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160111/de87d845/attachment-0001.html>


More information about the CMake mailing list