What is .a file in linux

WBOY
Release: 2022-07-14 16:06:21
Original
3230 people have browsed it

In Linux, the ".a" file is a static link library file; a static link library file refers to a function or process to be called that is linked to an executable file and becomes part of the executable file. The called function code is not copied to the application's executable file, but the description information of the called function is added to it.

What is .a file in linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is the .a file in Linux?

.a file is a static link library file in the LINUX system.

The so-called static linking refers to linking the function or process to be called into the executable file and becoming part of the executable file. When multiple programs call the same function, there will be multiple copies of the function in the memory, thus wasting precious memory resources. .so files are shared library files (dynamically linked). The function code called by dynamic linking is not copied to the executable file of the application, but only the description information of the called function (often some relocation information) is added to it. Only when the application is loaded When the memory starts running, under the management of the operating system, a link relationship is established between the application and the corresponding .so.

.a file is a combination of multiple .o files. The .o file is an object file, and the content contained in it is machine-executable instructions such as 01. When the program is to be executed, it needs to be linked. Linking is to link multiple .o files into an executable file.

Extended knowledge

.o is object, which is equivalent to the obj file compiled under windows, commonly known as the target file.

. a is archive, which is equivalent to the lib file compiled under Windows VC, commonly known as static library file.

.o file is a link file, .a is a static library file, generated by .o file, as a Libraries provide functions and interfaces for external programs.

Generate .o file:

gcc -c test.o test.c
Copy after login

Generate .a file:

ar cqs test.a test.o
Copy after login

.o is equivalent to the obj file in windows, one .c or .cpp file corresponds to one The .o file

.a is a combination of several .o files, used for static connection, that is, STATIC mode. Multiple .a files can be linked to generate an exe executable file

.so It is a shared object, used for dynamic connection. It is similar to the Windows dll. It is loaded only when used.

Recommended learning: Linux video tutorial

The above is the detailed content of What is .a file in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template