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 Compiler 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 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.

It should also be noted that 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 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.

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

Note:    The -Kextname option, which enables the use of extended filenames, is on automatically when you use sascc370 . To disable the use of extended names, you must specify -Knoextname .  [cautionend]

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. 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 additional information.

sascc370 -c alpha.c
Compiles the file alpha.c , generating the object file alpha.o . 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.c gamma.cxx
Compiles the file alpha.c as a C source file and the file gamma.cxx as a C++ source file, generating the prelinked output file beta and the object file alpha.o and gamma.o . 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 alpha.c
Compiles alpha.c , which may contain external C identifiers of lengths greater than 8 characters. The -Kextname compiler option specifies extended names.

sascc370 -o gamma alpha.c beta.c
Compiles the files alpha.c and beta.c . 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.c
Compiles beta.c , which is then prelinked with alpha.o and the C libraries to produce the prelinked output file a.out .

sascc370 -Krent -Tcms370 alpha.c beta.c
Compiles the files alpha.c and beta.c , 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.

sascc370 -Tpcms370 -Tallres notrans.c
Compiles notrans.c , using the all-resident library to generate an all-resident program targeted for a CMS system running in System/370 mode (pre-bimodal).

sascc370 -Tspe sysprog.c
Compiles sysprog.c , using the SPE library to generate a program targeted for the C Systems Programming Environment under OS/390.


Chapter Contents

Previous

Next

Top of Page

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