Reputation: 643
What exactly are .a
(e.g. libcrypto.a) files and what do they consists of? Is it .m
or .o
or .h
or .c
files?
How does IOS SDK/Xcode understands them? And if we include the .a
file in our xcode project, do we need to copy the correspondng sources file too?
Upvotes: 30
Views: 19304
Reputation: 206709
.a
files are static library files. They "contain" one or more .o
files, i.e. compiled code. To use them, you (often) need the header (.h
) files that correspond to the compiled code, but you do not need the source code (.c
, .m
) itself.
The .a
files are produced with the ar
utility, and the linker (ld
) that is (usually) invoked by your compiler knows their format and how to extract the relevant pieces of code from the archive and into your executable.
Upvotes: 49