Name Mangling - Name Mangling in Fortran

Name Mangling in Fortran

Name mangling is also necessary in Fortran compilers, originally because the language is case insensitive. Further mangling requirements were imposed later in the evolution of the language because of the addition of modules and other features in the Fortran 90 standard. The case mangling, especially, is a common issue that must be dealt with in order to call Fortran libraries (such as LAPACK) from other languages (such as C).

Because of the case insensitivity, the name of a subroutine or function "FOO" must be converted to a canonical case and format by the Fortran compiler so that it will be linked in the same way regardless of case. Different compilers have implemented this in various ways, and no standardization has occurred. The AIX and HP-UX Fortran compilers convert all identifiers to lower case ("foo"), while the Cray Unicos Fortran compilers converted identifiers all upper case ("FOO"). The GNU g77 compiler converts identifiers to lower case plus an underscore ("foo_"), except that identifiers already containing an underscore ("FOO_BAR") have two underscores appended ("foo_bar__"), following a convention established by f2c. Many other compilers, including SGI's IRIX compilers, gfortran, and Intel's Fortran compiler, convert all identifiers to lower case plus an underscore ("foo_" and "foo_bar_").

Identifiers in Fortran 90 modules must be further mangled, because the same subroutine name may apply to different routines in different modules.

Read more about this topic:  Name Mangling

Famous quotes containing the word mangling:

    How can anyone be interested in war?—that glorious pursuit of annihilation with its ceremonious bellowings and trumpetings over the mangling of human bones and muscles and organs and eyes, its inconceivable agonies which could have been prevented by a few well- chosen, reasonable words. How, why, did this unnecessary business begin? Why does anyone want to read about it—this redundant human madness which men accept as inevitable?
    Margaret Anderson (1886–1973)