Invoking the compiler

Different forms of the XL C/C++ compiler invocation commands support various levels of the C and C++ languages. In most cases, you should use the xlc command to compile your C source files, and the xlc++ command to compile C++ source files. Use xlc++ to link if you have both C and C++ object files.

You can use other forms of the command if your particular environment requires it. Table 1 lists the different basic commands, with the special versions of each basic command. Special commands are described in Table 2.

Note: For each invocation command, the compiler configuration file defines default option settings and, in some cases, macros; for information about the defaults implied by a particular invocation, see the /etc/vac.cfg for your system..
Table 1. Compiler invocations
Basic invocations Description Equivalent special invocations
xlc Invokes the compiler for C source files. This command supports all of the ISO C99 standard features, and most IBM language extensions. This invocation is recommended for all applications. xlc_r, xlc_r7, xlc128, xlc128_r, xlc128_r4, xlc128_r7
c99 Invokes the compiler for C source files. This command supports all ISO C99 language features, but does not support IBM language extensions. Use this invocation for strict conformance to the C99 standard. c99_r, c99_r4, c99_r7, c99_128, c99_128_r, c99_128_r4, c99_128_r7
c89 Invokes the compiler for C source files. This command supports all ANSI C89 language features, but does not support IBM language extensions. Use this invocation for strict conformance to the C89 standard. c89_r, c89_r4, c89_r7, c89_128, c89_128_r, c89_128_r4, c89_128_r7
cc Invokes the compiler for C source files. This command supports pre-ANSI C, and many common language extensions. You can use this command to compile legacy code that does not conform to standard C. cc_r, cc_r4, cc_r7, cc128, cc128_r, cc128_r4, cc128_r7
gxlc Invokes the compiler for C source files. This command accepts many common GNU C options, maps them to their XL C option equivalents, and then invokes xlc. For more information, refer to Reusing GNU C/C++ compiler options with gxlc and gxlc++.  
xlc++, xlC Invokes the compiler for C++ source files. If any of your source files are C++, you must use this invocation to link with the correct runtime libraries.

Files with .c suffixes, assuming you have not used the -+ compiler option, are compiled as C language source code.

xlc++_r, xlc++_r4, xlc++_r7, xlc++128, xlc++128_r, xlc++128_r4, xlc++128_r7, xlC_r, xlC_r4, xlC_r7, xlC128, xlC128_r, xlC128_r4, xlC128_r7
xlc++core, xlCcore Invokes the compiler as described above for xlc++ and xlC, but links only to the core of the runtime library. Use this invocation if you want to link your application to a runtime library other than that supplied with XL C++. xlc++core_r, xlc++core_r7, xlc++core128, xlc++core128_r, xlc++core128_r7, xlCcore_r, xlCcore_r7, xlC128core, xlC128core_r, xlC128core_r7
gxlc++, gxlC Invokes the compiler for C++ files. This command accepts many common GNU C/C++ options, maps them to their XL C/C++ option equivalents, and then invokes xlc++. For more information, refer to Reusing GNU C/C++ compiler options with gxlc and gxlc++.  
Table 2. Suffixes for special invocations
128-suffixed invocations All 128-suffixed invocation commands are functionally similar to their corresponding base compiler invocations. They specify the -qldbl128 option, which increases the length of long double types in your program from 64 to 128 bits. They also link with the 128-bit versions of the C and C++ runtime libraries.
_r-suffixed invocations All _r-suffixed invocations allow for threadsafe compilation and you can use them to link the programs that use multi-threading. Use these commands if you want to create threaded applications.

The _r7 invocations are provided to help migrate programs based on Posix Draft 7 to Posix Draft 10. The _r4 invocations should be used for DCE threaded applications. For more information about DCE, see What is DCE? in CICS® Transaction Server for z/OS® Information Center.