Next: , Previous: Pragma External, Up: Implementation Defined Pragmas


Pragma External_Name_Casing

Syntax:

     pragma External_Name_Casing (
       Uppercase | Lowercase
       [, Uppercase | Lowercase | As_Is]);

This pragma provides control over the casing of external names associated with Import and Export pragmas. There are two cases to consider:

Implicit external names
Implicit external names are derived from identifiers. The most common case arises when a standard Ada Import or Export pragma is used with only two arguments, as in:
             pragma Import (C, C_Routine);

Since Ada is a case-insensitive language, the spelling of the identifier in the Ada source program does not provide any information on the desired casing of the external name, and so a convention is needed. In GNAT the default treatment is that such names are converted to all lower case letters. This corresponds to the normal C style in many environments. The first argument of pragma External_Name_Casing can be used to control this treatment. If Uppercase is specified, then the name will be forced to all uppercase letters. If Lowercase is specified, then the normal default of all lower case letters will be used.

This same implicit treatment is also used in the case of extended DEC Ada 83 compatible Import and Export pragmas where an external name is explicitly specified using an identifier rather than a string.

Explicit external names
Explicit external names are given as string literals. The most common case arises when a standard Ada Import or Export pragma is used with three arguments, as in:
          pragma Import (C, C_Routine, "C_routine");

In this case, the string literal normally provides the exact casing required for the external name. The second argument of pragma External_Name_Casing may be used to modify this behavior. If Uppercase is specified, then the name will be forced to all uppercase letters. If Lowercase is specified, then the name will be forced to all lowercase letters. A specification of As_Is provides the normal default behavior in which the casing is taken from the string provided.

This pragma may appear anywhere that a pragma is valid. In particular, it can be used as a configuration pragma in the gnat.adc file, in which case it applies to all subsequent compilations, or it can be used as a program unit pragma, in which case it only applies to the current unit, or it can be used more locally to control individual Import/Export pragmas.

It is primarily intended for use with OpenVMS systems, where many compilers convert all symbols to upper case by default. For interfacing to such compilers (e.g. the DEC C compiler), it may be convenient to use the pragma:

     pragma External_Name_Casing (Uppercase, Uppercase);

to enforce the upper casing of all external symbols.