Chapter Contents

Previous

Next
Using the SAS/C Cross-Platform Compiler and C++ Development System

Compiling C++ Programs under UNIX

This section explains how to invoke the SAS/C Cross-Platform C++ Compiler directly with the sasCC370 command.


Using sasCC370

The sasCC370 compiler driver controls the compilation of your C++ source code. Invoke the compiler driver with the following command:

sasCC370 [options] [filename1 [filename2...]]

If specified, the options argument can be one or more of the compiler options described in Compiling C and C++ Programs, or the cool options described in Prelinking C and C++ Programs. (You can also view a partial listing of these options online by issuing the sasCC370 command without any arguments.) Some of the compiler options are particular to the sasCC370 driver, and others will alter the compilation in some manner. As mentioned in Overview of the SAS/C Cross-Platform Compiler and C++ Development System, the compiler driver processes these options during the phases of compilation, passing them to the appropriate executable file as necessary.

If you do not specify any compiler options, the C++ development system will generate prelinked, non-reentrant object code by default. Prelinking is accomplished by cool , which is normally invoked by the compiler driver.

Note:    The C++ development system generates object code targeted for an OS/390 environment by default. If you are compiling programs that you intend to run under CMS, you should specify either the -Tcms370 or the -Tpcms370 compiler option. See Compiling C and C++ Programs for more information about these options.  [cautionend]

The filename arguments specify a list of input files that are to be compiled or prelinked. Files with a .cxx , .cpp , .C , or .c extension will be considered to be C++ input and compiled as such. Files with a .o extension will be prelinked. See Files for more information about the files used by the cross-platform compiler.

It should also be noted that the -Kextname option, which enables the use of extended names, is on automatically when you use sasCC370 ; extended names processing cannot be disabled for C++ compilations.

The sasCC370 command is functionally equivalent to the sascc370 command with the -cxx option.

Examples

The following examples are command line invocations of the cross-platform compiler using sasCC370 :

sasCC370 alpha.cxx
Translates and compiles the file alpha.cxx , generating the prelinked output file a.out . Notice that a.out is the default filename for prelinked output.

Normally, the prelinked output is copied to the mainframe for final linking. However, you can also copy the object files to the mainframe and use COOL to generate a load module. See Linking C and C++ Programs for more information about prelinking and linking.

sasCC370 -c alpha.cxx
Translates and compiles the file alpha.cxx . The -c compiler option specifies that the object should not be prelinked; therefore, the output file a.out is not generated.

sasCC370 -o beta alpha.cxx
Translates and compiles the file alpha.cxx , generating the prelinked output file beta . The -o option is used to specify the name of the prelinked output file. Notice that beta is generated instead of the default a.out .

sasCC370 -o gamma alpha.cxx beta.cxx
Translates and compiles the files alpha.cxx and beta.cxx . The object files are then prelinked by cool , combining the output into the gamma file. The gamma file would then need to be copied to the mainframe for final linking.

sasCC370 alpha.o beta.cxx
Translates and compiles beta.cxx , which is then prelinked with alpha.o and the C++ and C libraries to produce the prelinked output file a.out .

sasCC370 -Krent -Tcms370 alpha.cxx beta.cxx
Translates and compiles the files alpha.cxx and beta.cxx , generating reentrant code targeted for a CMS system running under VM/ESA or VM/XA. The -Krent option specifies that reentrant modification of external variables is allowed, and the -Tcms370 option specifies that the cross-platform compiler preprocessor should use predefined CMS symbols and link with the CMS libraries.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.