Showing posts with label Makefile. Show all posts
Showing posts with label Makefile. Show all posts

Tuesday, August 7, 2012

[Introduction] ar and ranlib

ar and ranlib
ar this program can do the following actions to the archive (static library)
create, modify, and extract.Following is a list of several commonly used options explained:
  • d: delete
    • Remove files from the archive
  • r: replace
    • Insert archive files to be replaced
  • u: update
    • option 'r' is usually to replace all, but the option u only will be inserted over the files in the archive in
  • v: verbose
    • The implementation, as well as additional information
for example:
   > ar uv mylib.a first.o second.o

These directives is to establish two obj file into a mylib.a, and shows the implementation of the process information

ranlib generates an index to the contents of an archive and stores it in the archive. The index lists each symbol defined by a member of an archive that is a relocatable object file.

You can use nm-s or nm, - print-armap Include to list this index

To run this program is to increase the speed of linking to the library and allows routines in the library can call each other without having to worry about these routines in the archive of the placement order