Difference between Static library commands
ar crf library.a file1.o file2.o
ar rvs library.a.a file1.o file2.o
ar rs liblprprint.a lpr_print.o
ar rcs library.a file1.o file2.o
Actually I have googled about the static library and I found these 4 commands that can be used to create a static library in gcc.Out of 2 are searched in the previous answers of stackoverflow .The thing I want to know is, Is there any difference between these 4 commands? Do they d开发者_StackOverflow中文版iffer in creating a static library in any aspect. because we can follow one command to create a static library but why do we have 4 commands to create a static library. These made me believe there must be a difference between all the 4 commands.I tried it on google but they gave the command but i did not find the differnces between them.So does anybody know why do we got 4 commands to work on while creating a static library?What would be the difference between them? I mean rs,rcs,rvs, why we have them?
From man ar
-c Suppresses the diagnostic message that is written to standard error by default when archive is created. -r Replaces or adds files in archive. If archive does not exist, a new archive file is created. -v Gives verbose output. When used with options -d, -r, or -x, the -v option writes a detailed file- by-file description of the archive creation and the constituent files, and maintenance activity. -s Forces the regeneration of the archive symbol table even if ar is not invoked with an option that will modify the archive contents.
精彩评论