In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Create a program-compatible contract (ABI) 1. What is API?
ABI (application binary interface), which refers to the application binary interface.
EABI (embeded application binary interface), which refers to the embedded application binary interface, differs from ABI in that privileged instructions are allowed in the application.
In the broad sense, the probability of ABI refers to the specification of the application at the binary level, and in the narrow sense it refers to the specification document of a hardware / operating system / virtual machine platform.
The difference between 2.ABI and API:
ABI is a binary-level specification, while API is a source-level specification. There is no direct connection between the two.
Systems that follow the same ABI may provide a different API:
The same and different systems such as Windows and Linux can be installed on computers because they follow the same ABI specification, but the source code is different and the reasons for API are different.
Systems that follow the same API may provide a different ABI:
After the QT application is developed (same API, source code), it can be run on Windows and Linux, but the executable files are different after compilation (different ABI is followed when compiling)
Java cross-platform principle:
The compiled binaries are the same and are translated into executable programs of the corresponding platform by running java virtual machines on different platforms (the translation rule is the ABI specification of the platform).
The principle of QT cross-platform:
The same source code (api) is compiled on different platforms and becomes executable programs for each platform (the compilation specification complies with the ABI specification of the platform).
3. What does API have? 3.1 defines the size of the underlying data type
Considering the portability of the program from this point of view, we only need to modify the type adaptation layer to make the data type meet the platform specification.
3.2 defines the alignment of the common body / structure
As in the following program, there are two ways to deal with it, and compressed storage is used in Linux.
Struct {short s: 9; int j: 9; char c; short t: 9; short u: 9; char d;} s
Output result under Linux:
3.3 defines the use of hardware registers
Registers are the carriers that the processor uses to process data, and some registers define their functions at the time of processor design.
ABI specification for X86 registers:
ABI specification of Power PC register
3.4 defines the convention when calling a function
When the function is called, the parameters are passed to the called function, and the return value is returned to the function caller.
The calling convention describes how the parameters are passed to the stack and how the stack is maintained: the order in which the parameters are passed (such as entering the stack from left to right) and the cleaning of the calling stack (such as the called function is responsible for cleaning the stack).
Calling conventions are commonly used for invocation and library development:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.