Other ILE Languages

The standard C/C++ library functions are easily accessible in the C and C++ languages if you include the appropriate header files and use the appropriate C or C++ compilation command. The functions are also accessible from other ILE languages, such as RPG, COBOL, and CL, although no header files are provided for these languages. An additional consideration exists for those functions which are locale sensitive (that is, dependent upon the current locale). When you use the C or C++ compiler, the default locale is loaded automatically at program startup time. When you use any of the C/C++ library functions from a different language, a call to setlocale() should be added when the application starts to ensure that the proper locale is loaded. Here is a table which describes the correct call to setlocale() based on the desired LOCALETYPE.

C/C++ compiler option Function call
LOCALETYPE(*CLD) setlocale(LC_ALL, "")
LOCALETYPE(*LOCALE) _C_PSX_setlocale(LC_ALL, "")
LOCALETYPE(*LOCALEUCS2) _UCS2_setlocale(LC_ALL, "")
LOCALETYPE(*LOCALEUTF) _C_UTF_setlocale(LC_ALL, "")