Prev | Current Page 1419 | Next

Christopher Negus

"Linux Bible, 2008 Edition: Boot up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions"

ar also creates and maintains a table that cross-references
symbol names to the members in which they are defined. The ar command has the following
syntax:
ar {dmpqrtx} [options] [member] archive file [...]
ar creates the archive named archive from the file(s) listed in file. At least one of d, m, p, q, r,
t, and x is required. You will usually use r. Table 29-4 lists the most commonly used ar options.
790
Programming in Linux Part VI
TABLE 29-4
ar Command-Line Options
Option Description
-c Suppresses the warning ar would normally emit if the archive doesn??™t already exist.
-q Adds files to the end of archive without checking for replacements.
-r Inserts files into archive, replacing any existing members whose name matches that
being added. New members are added at the end of the archive.
-s Creates or updates the map linking symbols to the member in which they are defined.
Given an archive created with the ar command, you can speed up access to the archive
by creating an index to the archive. ranlib does precisely this, storing the index in the
archive file itself. ranlib??™s syntax is:
ranlib [-v|-V] file
This generates a symbol map in file. It is equivalent to ar -s file.
The ldd Command
While nm lists the symbols defined in an object file, unless you know what library defines which
functions, it is not terribly helpful.


Pages:
1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431