IBM Support

pragma map requires users to escape out "variant" characters

Technote (FAQ)


Why do the pragma map statements have escape characters in them?


The #pragma map statement maps a C style function name to an external reference used for linking. An example is:

#pragma map(__fp_setmode,"\174\174FPSETM")    

The above statement indicates that the coded function "__fp_setmode" will be mapped to @@FPSETM for linking purposes.

The reason that this is performed has to do with foreign locales and variant characters.

The locale compiler option tells the compiler that the source code is to be interpreted using a specific code page. This code page indicates how certain characters are to be represented; for example, square brackets, curly brackets, the @ sign.

Most headers have a filetag as one of the first statements that indicates what language the header is written in; for example:
??=pragma filetag("IBM-1047")  

The above filetag pragma indicates that the header was coded in 1047 which is US-english.

If a user passes a locale option like : LOCALE(DE_DE.IBM-273), the compiler will see that the code page requested by the user is German (IBM-273). The compiler then converts the header file with the filetag("IBM-1047") to code page 273. Any variant characters such as @ are converted from the US-code page (remember we indicated the header was English) to the German code page.
Thus the function is mapped to the German @ sign, not the US @ sign. These 2 characters are totally different in the code page layouts.

During the link, the linker fails since it cannot find the German @ member. Only the US @ member was supplied by the vendor.

The user must then escape out the pragma map name using \173 to indicate to the compiler that the string element should not be translated.

Cross Reference information
Segment Product Component Platform Version Edition
Software Development OS/390 C/C++ Not Applicable OS/390, z/OS All

Document information

More support for: z/OS XL C/C++

Software version: All versions

Operating system(s): z/OS

Software edition: All Editions

Reference #: 1082674

Modified date: 27 October 2010