Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

FORTRAN mixed with C++

Schwandt__Olaf
Beginner
235 Views

Hi Steve, hi all,

 

it is so confusing what I find about mixing FORTRAN and C++

I have Visual Studio 2017 with Intel Parallel Studio XE 2018 and Microsoft Visual C++ 2017.

My FORTRAN-routine should call C++ routines. Can you tell me exactly how I can do that?

 

Thanks in advance!

 

Olaf

0 Kudos
2 Replies
Steve_Lionel
Honored Contributor III
235 Views

Fortran interfaces well with C. To the extent that you can make C++ look like C, it works pretty well. For C++ functions you call, you must use the 'extern "C"'' prefix in C++. You will be restricted to argument types supported by both languages.

A complete worked example is "Fortran_Calls_C" in the Intel Parallel Studio XE for Windows Samples Bundle (under compiler_f\MixedLanguage).

See also https://software.intel.com/en-us/blogs/2012/05/11/doctor-fortran-in-i-can-c-clearly-now-part-i - sadly, I never got around to writing Part II.

0 Kudos
Schwandt__Olaf
Beginner
235 Views

oh, that's right. Thank you Steve, I will check this

0 Kudos
Reply