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

c++ subroutine called by Fortran main program.

rainer_feldbacher
308 Views

I have MS Visual Studio.NET 2003 with Intel Fortran Compiler Integration.
I have a large Fortran Program (Console Application) and I want to write a single subroutine (or function) in c++.
This subroutine shall be called by the Fortran Program.

How must I proceed?
Must I make a second (C++-) Project? What sort of Project?

How do I link that subroutine into my Fortran Program?

Say, for example, this is my Fortran code:

MixFortran.f90 
!
! FUNCTIONS:
! MixFortran - Entry point of console application.
!
!****************************************************************************
!
! PROGRAM: MixFortran
!
! PURPOSE: Entry point for the console application.
!
!****************************************************************************
 program MixFortran
 implicit none
 real a,b,c,d
real fsumme
external fsumme
a=4.
b=5.
c=6.
d=fsumme(a,b,c)
write(6,*)d
stop
 end program MixFortran
The function "fsumme" simply calculates the sum of the three arguments.
How must I proceed to write the Function "fsumme" in c++ and to
link it to a running exe?

					
				
			
			
				
			
			
			
			
			
			
			
		
0 Kudos
0 Replies
Reply