LONGNAME | NOLONGNAME

Category

Object code control

Pragma equivalent

#pragma longname, #pragma nolongname You can use the #pragma preprocessor directive to override the default values for compiler options. However, for LONGNAME | NOLONGNAME, the compiler options override the #pragma preprocessor directives.

Purpose

Provides support for external names of mixed case and up to 1024 characters long.

When the LONGNAME compiler option is in effect, the compiler generates untruncated and mixed case external names in the object module produced by the compiler for functions with non-C++ linkage.

When the NOLONGNAME compiler option is in effect:
  • The compiler generates truncated and uppercase names in the object module.
  • Only those functions that do not have C++ linkage are given truncated and uppercase names.
  • The XL C compiler truncates all the external names to 8 characters whereas the XL C++ compiler only truncates the external functions to 8 characters.

Syntax

For C:

Read syntax diagramSkip visual syntax diagram
   .-NOLO-.   
>>-+-LO---+----------------------------------------------------><

For C++:

Read syntax diagramSkip visual syntax diagram
   .-LO---.   
>>-+-NOLO-+----------------------------------------------------><

Defaults

For C, the default option is NOLONGNAME. For C++, the default option is LONGNAME.

For the z/OS® UNIX System Services utilities, the default for a regular compile is LONGNAME.

Usage

Functions with C++ linkage are always untruncated and mixed-case external names.

The system binder recognizes the format of long external names in object modules, but the system linkage editor does not.

For z/OS XL C, if you specify the ALIAS option with LONGNAME, the compiler generates a NAME control statement, but no ALIAS control statements.

If you use #pragma map to associate an external name with an identifier, the compiler generates the external name in the object module. That is, #pragma map has the same behavior for the LONGNAME and NOLONGNAME compiler options. Also, #pragma csect has the same behavior for the LONGNAME and NOLONGNAME compiler options.

A comment that indicates the setting of the LONGNAME option will be generated in your object module to aid you in diagnosing your program.

IPA effects

For C only, LONGNAME is always in effect even if you specify NOLONGNAME. Either the LONGNAME compiler option or the #pragma longname preprocessor directive is required for the IPA compile step.

The IPA link step ignores this option if you specify it, and uses the LONGNAME option for all partitions it generates.

Predefined macros

For C, __LONGNAME__ is predefined to 1 when the LONGNAME compiler option is in effect.

For C++, __LONGNAME__ is always predefined to 1 regardless of the LONGNAME compiler option.

For C++, __IBMCPP_LONGNAME__ is defined as 1 if the LONGNAME compiler option is in effect, and it is undefined if the NOLONGNAME compiler option is on.

Note: __IBMCPP_LONGNAME__ is only available starting with z/OS V1R10. Please check your XL C++ compiler level by using __IBMCPP__ when using __IBMCPP_LONGNAME__. For more information, see the z/OS XL C/C++ Language Reference.