xcode 什么是 .a(作为 libcrypto.a)文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8224035/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is a .a (as libcrypto.a) file?
提问by chetan
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?
到底什么是.a
(例如 libcrypto.a)文件,它们由什么组成?它是.m
或.o
或.h
或.c
文件?
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?
IOS SDK/Xcode 如何理解它们?如果我们将.a
文件包含在我们的 xcode 项目中,我们是否也需要复制相应的源文件?
回答by Mat
.a
files are static libraryfiles. 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.
.a
文件是静态库文件。它们“包含”一个或多个.o
文件,即编译后的代码。要使用它们,您(通常)需要与.h
编译代码相对应的头文件( ),但不需要源代码 ( .c
, .m
) 本身。
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.
这些.a
文件是使用ar
实用程序生成的,并且ld
(通常)由您的编译器调用的链接器 ( ) 知道它们的格式以及如何从存档中提取相关代码段并将其提取到您的可执行文件中。