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.
Содержание TMS320C54x
Страница 38: ......
Страница 39: ......
Страница 40: ......
Страница 41: ......
Страница 42: ......
Страница 43: ......
Страница 44: ......
Страница 45: ......
Страница 46: ......
Страница 47: ......
Страница 48: ......
Страница 49: ......
Страница 50: ......
Страница 51: ......
Страница 52: ......
Страница 53: ......
Страница 54: ......
Страница 55: ......
Страница 56: ......
Страница 57: ......
Страница 58: ......
Страница 59: ......
Страница 60: ......
Страница 61: ......
Страница 62: ......
Страница 276: ......
Страница 277: ......
Страница 278: ......
Страница 279: ......
Страница 280: ......
Страница 281: ......
Страница 282: ......
Страница 283: ......
Страница 284: ......
Страница 285: ......
Страница 286: ......
Страница 287: ......
Страница 288: ......
Страница 289: ......
Страница 290: ......
Страница 291: ......
Страница 292: ......
Страница 293: ......
Страница 294: ......
Страница 295: ......
Страница 296: ......
Страница 297: ......
Страница 298: ......
Страница 299: ......
Страница 300: ......
Страница 301: ......
Страница 302: ......