Naming Conventions for Fortran, C, and C++

The following table summarizes how Fortran, C, and C++ handle procedure names:

Naming Conventions in Fortran, C, and C++

Language

Attributes

Name Translated As

Case of Name in .o File

Fortran

cDEC$ ATTRIBUTES C

_name

All lowercase

Fortran

cDEC$ ATTRIBUTES STDCALL

_name@n

All lowercase

Fortran

default

_name

All uppercase

C

cdecl (default)

_name

Mixed case preserved

C

__stdcall

_name@n

Mixed case preserved

C++

Default

_name@@decoration

Mixed case preserved

In the preceding table:

For example, assume a function is declared in C as:

  extern int __stdcall Sum_Up( int a, int b, int c );

Each integer occupies 4 bytes, so the symbol name placed in the .o file on IA-32 systems is:

  _Sum_Up@12

On Itanium-based systems, the symbol name placed in the .o file is:

  Sum_Up