[CMake] FORTRAN name mangling

Bill Somerville bill at classdesign.com
Mon Jan 11 13:11:42 EST 2016


On 11/01/2016 17:58, Michael Jackson wrote:
> subroutine SingleEBSDPattern(ipar, fpar, EBSDpattern, quats, accum_e, 
> mLPNH, mLPSH) bind(c, name='SingleEBSDPattern')
>
Surely if you use bind(C) you need do no more than extern "C" the 
declaration when compiling C++. I thought bind(C) meant mangle the 
external name in the same way that a C module would.

We use the FortranCInterface module for old Fortran procedures that are 
not using ISO_C_BINDING and bind(C), for them we add the symbols to the 
FortranCInterface_HEADER() command and use the generated macros to 
reference the symbols in C/C++.

We also execute FortranCInterface_VERIFY(CXX QUIET) before the 
FortranCInterface_HEADERS() command.

It all works OK but we only use gcc/g++/Clang/Clang++/gfortran compilers.

Regards
Bill Somerville.


More information about the CMake mailing list