Chapter 28 . Programming Tools and Utilities 735 (My space web page)

Chapter 28 . Programming Tools and Utilities 735 The ar Command ar creates, modifies, or extracts archives. It is most commonly used to create static libraries, which are files that contain one or more object files. 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 28-4 lists the most commonly used ar options. Table 28-4 ar Command-Line Options Option Description -c Creates a new archive file archive if it doesn t exist, suppressing the warning ar would emit if 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. That is ldd s job. It lists the shared libraries that a program requires to run. Its syntax is: ldd [options] file Tip
If you are in need for chaep and reliable webhost to host your website, our recommendation is http web server services.

Leave a Reply