What exactly does the ar utility do?

I really don't understand what the utility does arfor Unix systems.

I know that it can be used in some way to create c libraries, but all that this page tells me is that it is used to create archives from files, which looks like, for example, tar....

+3
source share
6 answers

The main goal is to take individual object files ( *.o) and merge them together into a static library file ( *.a). The .a file contains an index that allows the linker to quickly find characters in the library.

Tar does not create files that linkers understand.

+7

ar , tar. "" , , , tar, , . ar Debian .deb.

+4

, ar . (*.o) , .

+2

(.obj,.o ..) (). ld .

.

+1

man ar, . .

:

GNU ar , .         - ,        ,         ( ).

ar ,         , .

+1

ar specifically for archives (or libraries) of object code; tar is for archives of arbitrary files. Does anyone know why GNU refers to them as "archives", in other environments this utility is called a "librarian", and the resulting files are just libraries.

+1
source

Source: https://habr.com/ru/post/1719824/


All Articles