Archives and --start-lib
原文: Archives and --start-lib
.a archives
Unix-like systems represent static libraries as
.a
archives. A
.a
archive has a header and a collection of .o files (relocatable object files) and their metadata. One may add others files to
.a
but that is almost assuredly a bad thing.
% as /dev/null -o a.o
% cp a.o b.o
% rm -f b.a && ar rc b.a b.o
% rm -f a.a && ar rc a.a a.o b.a # archive in archive, bad