-qextname

Category

Portability and migration

Purpose

Adds an underscore to the names of all global entities.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-noextname----------------.   
        |             .-:--------. |   
        |             V          | |   
>>- -q--+-extname--=------name---+-+---------------------------><

@PROCESS:

@PROCESS EXTNAME[(name1, name2,...)] | NOEXTNAME

Defaults

-qnoextname

Parameters

name
Identifies a specific global entity (or entities). For a list of named entities, separate each name with a colon. For example: name1: name2:....

The name of a main program is not affected.

Usage

The -qextname option helps to port mixed-language programs to XL Fortran without modifications.

Use of this option avoids naming problems that might otherwise be caused by:
  • Fortran subroutines, functions, or common blocks that are named main, MAIN, or have the same name as a system subroutine
  • Non-Fortran routines that are referenced from Fortran and contain an underscore at the end of the routine name
    Note: XL Fortran Service and Utility Procedures , such as flush_ and dtime_, have these underscores in their names already. By compiling with the -qextname option, you can code the names of these procedures without the trailing underscores.
  • Non-Fortran routines that call Fortran procedures and use underscores at the end of the Fortran names
  • Non-Fortran external or global data objects that contain an underscore at the end of the data name and are shared with a Fortran procedure

If your program has only a few instances of the naming problems that -qextname solves, you may prefer to select new names with the -brename option of the ld command.

You must compile all the source files for a program, including the source files of any required module files, with the same -qextname setting.

If you use the xlfutility module to ensure that the Service and Utility subprograms are correctly declared, you must change the name to xlfutility_extname when compiling with -qextname.

If there is more than one Service and Utility subprogram referenced in a compilation unit, using -qextname with no names specified and the xlfutility_extname module may cause the procedure declaration check not to work accurately.

This option also affects the names that are specified in the -qextern, -qinline, and -qsigtrap options. You do not have to include underscores in their names on the command line.

Examples

@PROCESS EXTNAME
        SUBROUTINE STORE_DATA
        CALL FLUSH(10)  ! Using EXTNAME, we can drop the final underscore.
        END SUBROUTINE
@PROCESS(EXTNAME(sub1))
program main
  external :: sub1, sub2
  call sub1()               ! An underscore is added.
  call sub2()               ! No underscore is added.
end program

Related information