Difference between revisions of "Main Page/C Fortran"

From Nekcem
Jump to navigationJump to search
Line 1: Line 1:
 
== PGI compiler name mangling convention ==
 
== PGI compiler name mangling convention ==
When programs are compiled using one of the PGI Fortran compilers on UNIX systems, an underscore is appended to Fortran global names (names of functions, subroutines and common blocks). This mechanism distinguishes Fortran name space from C/C++ name space. If you call a C/C++ function from Fortran, you should rename the C/C++ function by appending an underscore (or use C$PRAGMA C in the Fortran program, refer to Chapter 9, Optimization Directives and Pragmas, for details on C$PRAGMA C) If you call a Fortran function from C/C++, you should append an underscore to the Fortran function name in the calling program.
+
When programs are compiled using one of the PGI Fortran compilers on UNIX systems, an underscore is appended to Fortran global names (names of functions, subroutines and common blocks).  
 +
This mechanism distinguishes Fortran name space from C/C++ name space.  
 +
 
 +
If you call a C/C++ function from Fortran, you should rename the C/C++ function by appending an underscore (or use C$PRAGMA C in the Fortran program, refer to Chapter 9, Optimization Directives and Pragmas, for details on C$PRAGMA C)  
 +
 
 +
If you call a Fortran function from C/C++, you should append an underscore to the Fortran function name in the calling program.
 +
 
 
source: http://www.tacc.utexas.edu/services/userguides/pgi/pgiws_ug/pgi32u07.htm#Heading93
 
source: http://www.tacc.utexas.edu/services/userguides/pgi/pgiws_ug/pgi32u07.htm#Heading93
  

Revision as of 12:47, 19 May 2011

PGI compiler name mangling convention

When programs are compiled using one of the PGI Fortran compilers on UNIX systems, an underscore is appended to Fortran global names (names of functions, subroutines and common blocks). This mechanism distinguishes Fortran name space from C/C++ name space.

If you call a C/C++ function from Fortran, you should rename the C/C++ function by appending an underscore (or use C$PRAGMA C in the Fortran program, refer to Chapter 9, Optimization Directives and Pragmas, for details on C$PRAGMA C)

If you call a Fortran function from C/C++, you should append an underscore to the Fortran function name in the calling program.

source: http://www.tacc.utexas.edu/services/userguides/pgi/pgiws_ug/pgi32u07.htm#Heading93









2.1- SUBROUTINE

For a Fortran CALL SUB the corresponding C routine has to be named:

SUB

   all upper case on Cray with cft77 compiler 

sub

   all lower case on Apollo with ftn compiler 
   case insensitive on IBM/370 and VMS 

sub_

   lower case with underscore added on all other system