[CMake] FORTRAN name mangling

Thompson, KT kgt at lanl.gov
Mon Jan 11 14:24:00 EST 2016


Michael,

You should always test your toolchain first.  Compilers are often buggy or may not fully support a language feature.  But yes, requiring F2003 should address your concern.

-kt

-----Original Message-----
From: Michael Jackson [mailto:mike.jackson at bluequartz.net] 
Sent: Monday, January 11, 2016 12:11 PM
To: Thompson, KT <kgt at lanl.gov>
Cc: cmake at cmake.org
Subject: Re: [CMake] FORTRAN name mangling

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.

--
Michael A. Jackson
BlueQuartz Software, LLC
[e]: mike.jackson at bluequartz.net

> On Jan 11, 2016, at 2:06 PM, Thompson, KT <kgt at lanl.gov> wrote:
> 
> "bind(c)" is a part of the Fortran 2003 standard.  Any compiler that claims to support this standard should work for you.
> 
> I use Intel Fortran on Linux (v13-16) with bind(c) w/o issue.  FWIW - I also use the Portland Group (12+) and IBM Fortran (v14) compilers this way.
> 
> -kt
> 
> -----Original Message-----
> From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Michael Jackson
> Sent: Monday, January 11, 2016 11:48 AM
> To: Bill Somerville <bill at classdesign.com>
> Cc: cmake at cmake.org
> Subject: Re: [CMake] FORTRAN name mangling
> 
> Actually, 
>  If we just use the following:
> 
> SingleEBSDPattern(ipar, fpar, ebsdPattern, quats, accum_e, mLPNH, mLPSH);
> 
> and the same declaration in a .h file then we can link and execute just fine. My question now would be:
> 
> Do other FORTRAN compilers support this “bind(C)” thing, such as Intel Fortran? If so then I can really NOT worry about figuring out the mangling that is needed and just declare the functions in a C style header like normal. No macros needed.
> --
> Michael A. Jackson
> BlueQuartz Software, LLC
> [e]: mike.jackson at bluequartz.net
> 
>> On Jan 11, 2016, at 1:13 PM, Bill Somerville <bill at classdesign.com> wrote:
>> 
>> On 11/01/2016 17:58, Michael Jackson wrote:
>>> and we call the function from our C code like the following:
>>> 
>>> 
>>> SingleEBSDPattern_(ipar, fpar, ebsdPattern, quats, accum_e, mLPNH, mLPSH);
>>> 
>> You need to use the macros here too.
>> 
>> Regards
>> Bill Somerville.
>> -- 
>> 



More information about the CMake mailing list