Invoking the Linker With the Compiler Shell (
−
z Option)
4-4
4.2 Invoking the Linker With the Compiler Shell (
−
z Option)
The options and parameters discussed in this section apply to both methods
of linking; however, when you link while compiling, the linker options must fol-
low the
−
Invoking the C Compiler Shell,
By default, the compiler does not run the linker. However, if you use the
−
z op-
tion, a program is compiled, assembled, and linked in one step. When using
−
z to enable linking, remember that:
-
The
−
z option divides the command line into compiler options (the options
before
−
z) and linker options (the options following
−
z).
-
The
−
z option must follow all source files and other compiler options on the
command line or be specified with the C_OPTION environment variable.
All arguments that follow
−
z on the command line are passed on to the linker.
These arguments can be linker command files, additional object files, linker
options, or libraries. For example, to compile and link all the .c files in a directo-
ry, enter:
dspcl −sq *.c −z c.cmd −o prog.out −l rts25.lib
First, all of the files in the current directory that have a .c extension are com-
piled using the
−
s (interlist C and assembly code) and
−
q (run in quiet mode)
options. Second, the linker links the resulting object files by using the c.cmd
command file. The
−
o option names the output file, and the
−
l option names
the run-time-support library.
The order in which the linker processes arguments is important. The compiler
passes arguments to the linker in the following order:
1) Object filenames from the command line
2) Arguments following the
−
z option on the command line
3) Arguments following the
−
z option from the C_OPTION environment
variable
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...