Chapter Contents

Previous

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

Compiling C and C++ Programs under a DOS Shell

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

Under UNIX, you use the sascc370 compiler driver to compile C object code and the sasCC370 compiler driver to compile C++ object code. Under Microsoft-DOS, however, you use the sascc370 compiler driver to compile both C and C++ object code.


Using sascc370

The sascc370 compiler driver controls the compilation of your C or C++ object 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 (for example, -v ) are particular to the sascc370 driver, and others will alter the compilation phases in some manner. 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 cross-platform compiler will generate prelinked, non-reentrant object code by default. Prelinking is accomplished by cool , which is normally invoked by the compiler driver.

Note:    The cross-platform compiler generates object code targeted for an OS/390 environment by default. If you are compiling programs that you intend to run on another operating system, you should specify the -Txxx option. For example, if you are compiling programs you intend to run under CMS, specify either the -Tcms370 or the -Tpcms370 compiler option. See Compiler Options 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 , or .c extension are considered to be C++ input and are compiled as such. Files with a .o extension are prelinked. See Files for more information about the files used by the cross-platform compiler.

The sascc370 compiler driver examines the filename extension to determine whether the file contains source code ( .cxx , .cpp , or .c ) or compiled objects ( .o , .obj , or .a ). The driver then takes actions based on the compiler options and the types of input files specified on the command line.

Examples

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

sascc370 alpha.c
Compiles the file alpha.c , 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.

sascc370 -c alpha.c
Compiles the file alpha.c , generating the prelinked output file a.out . The -c compiler option specifies that the object should not be prelinked.

sascc370 -o beta alpha.c
Compiles the file alpha.c , 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 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 beta alpha.c gamma.cxx
Compiles the source file alpha.c as a C source file and gamma.cxx as a C++ source file, generating the object files alpha.o and gamma.o . The object files are then prelinked by cool , combining the output into the beta file. 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 -Kextname -Krent alpha.c
Compiles alpha.c , which may contain external C identifiers of lengths greater than 8 characters. The -Kextname compiler option specifies extended names. The -Krent option specifies that reentrant modification of external variables is allowed. The prelinked output file will be named a.out .


Chapter Contents

Previous

Next

Top of Page

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