Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
13 Views

FORTRAN mixed with C++

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
Black Belt Retired Employee
13 Views

Fortran interfaces well with

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.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner
13 Views

oh, that's right. Thank you

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

0 Kudos