The kcc
command invokes a driver program that
automatically calls KAP, C compiler, and the linker.
kcc
Because kcc
calls KAP and the C compiler, you can
substitute the kcc
command for the C command. For
example, to use kcc
to compile myprog.c
with the default KAP qualifier settings, use the command:
kcc myprog.c
The kcc
command uses the KAP preprocessor on
myprog.c
, compiles the result with the C compiler,
links the object code into an executable image, and produces the
following files in the current directory:
myprog_cmp.c
- the optimized source file
myprog.out
- the annotated source file
showing default KAP qualifier settings
myprog.obj
- the object file
myprog.exe
- an executable file
To cause KAP to generate an executable file with a name you
specify, use the /executable
qualifier as follows:
kcc /executable=my_prog
my_prog.exe
results.
kcc
inserts /executable
in front of the
first file name it sees. For example, the following command line
produces one executable named file_1.exe
.
kcc file_1.c file_2.c file_3.c
To see a list of the KAP qualifiers and C compiler qualifiers
passed by kcc
, use the /verbose
qualifier as follows:
kcc /ckapargs=(/verbose) myprog.c
An example of the output is as follows:
kcc /ckapargs=(/verbose) MYPROG.C cc /define=(__KAP,__ALPHA,__DECC,_FASTMATH,_INLINE_INTRINSICS,_INTRINSICS) - /NOLINE_DIRECTIVES/PREPROCESS_ONLY=ktmpa50340.c myprog.c kapc /cmp=myprog_cmp.c ktmpa50340.c KAP/Digital_VMS_C 3.1 k271906 970317 10-Apr-1997 12:13:09 0 errors in file ktmpa50340.c Issuing the compiler command: cc/optimize=(tune=host,level=4)/ANSI_ALIAS myprog_cmp.c issuing link command: link /EXECUTABLE=myprog.exe myprog_cmp.obj,SYS$COMMON:[SYSLIB]kio/lib
kcc
The ckapargs
qualifier specifies one or more
KAP command qualifier to the preprocessor. For example,
to use kcc
to optimize and compile the file
myprog.c
using KAP qualifiers for general
optimization, use the command:
kcc /ckapargs=(/optimize=5/roundoff=3/scalaropt=3/list=myprog_annotated.out) - myprog.c
The following files result:
myprog_cmp.c
- the optimized source file
myprog_annotated.out
- the annotated
source file renamed /list
qualifier
myprog.obj
- the object file
myprog.exe
- the executable file
For descriptions of all KAP command qualifiers, see Chapter 4.
kcc
Any command-line qualifier that is valid for the C compiler or
the linker is valid for the kcc
command. You can
specify compiler qualifiers and KAP qualifiers on the same line,
as follows:
kcc /ckapargs=(/optimize=5/roundoff=3/scalaropt=3)/nowarn myprog.c
The kcc
command specifies the C compiler qualifiers
/optimize=(tune=host,level=4)
and /ansi_
alias
by default. The /optimize=(tune=host)
qualifier causes the compiler to optimize to the host architecture.
For example, if you want to optimize for the ev5
architecture but are compiling on an ev4
system,
you should override the default setting of the /tune
qualifier, as follows:
kcc /optimize=(tune=ev4,level=4) myprog.c