Object Libraries
7-25
Linker Description
7.6
Object Libraries
An object library is a partitioned archive file that contains complete object files
as members. Usually, a group of related modules are grouped together into
a library. When you specify an object library as linker input, the linker includes
any members of the library that define existing unresolved symbol references.
You can use the archiver to build and maintain libraries. Chapter 6,
Archiver
Description, contains more information about the archiver.
Using object libraries can reduce link time and the size of the executable
module. Normally, if an object file that contains a function is specified at link
time, it is linked whether it is used or not; however, if that same function is
placed in an archive library, it is included only if it is referenced.
The order in which libraries are specified is important because the linker
includes only those members that resolve symbols that are undefined when
the library is searched. The same library can be specified as often as neces-
sary; it is searched each time it is included. Alternatively, the –x option can be
used. A library has a table that lists all external symbols defined in the library;
the linker searches through the table until it determines that it cannot use the
library to resolve any more references.
The following examples link several files and libraries. Assume that:
-
Input files f1.obj and f2.obj both reference an external function named
clrscr
-
Input file f1.obj references the symbol origin
-
Input file f2.obj references the symbol fillclr
-
Member 0 of library libc.lib contains a definition of origin
-
Member 3 of library liba.lib contains a definition of fillclr
-
Member 1 of both libraries defines clrscr
For example, if you enter the following, the references are resolved as shown:
lnk500
f1.obj liba.lib f2.obj libc.lib
-
Member 1 of liba.lib satisfies both references to clrscr because the library
is searched and clrscr is defined before f2.obj references it.
-
Member 0 of libc.lib satisfies the reference to origin.
-
Member 3 of liba.lib satisfies the reference to fillclr.
Summary of Contents for TMS320C54x
Page 38: ......
Page 39: ......
Page 40: ......
Page 41: ......
Page 42: ......
Page 43: ......
Page 44: ......
Page 45: ......
Page 46: ......
Page 47: ......
Page 48: ......
Page 49: ......
Page 50: ......
Page 51: ......
Page 52: ......
Page 53: ......
Page 54: ......
Page 55: ......
Page 56: ......
Page 57: ......
Page 58: ......
Page 59: ......
Page 60: ......
Page 61: ......
Page 62: ......
Page 276: ......
Page 277: ......
Page 278: ......
Page 279: ......
Page 280: ......
Page 281: ......
Page 282: ......
Page 283: ......
Page 284: ......
Page 285: ......
Page 286: ......
Page 287: ......
Page 288: ......
Page 289: ......
Page 290: ......
Page 291: ......
Page 292: ......
Page 293: ......
Page 294: ......
Page 295: ......
Page 296: ......
Page 297: ......
Page 298: ......
Page 299: ......
Page 300: ......
Page 301: ......
Page 302: ......