Lably
Skip to content

Application binary interface

Interface to software defined in terms of in-process, machine code access

  • 6 min read
  • 4 chapters

Related on Lably

Through Interface (computing), Software and Process (computing)

An ABI is at a relatively low level of abstraction. Interface compatibility depends on the target hardware and the software build toolchain. In contrast, an application programming interface (API) defines access in source code, which is a relatively high-level, hardware-independent, and human-readable format. An API defines an interface at the source code level, before compilation, whereas an ABI defines an interface to compiled code.

API compatibility is generally the concern for system design and of the toolchain. However, a programmer may have to deal with an ABI directly when writing a program in multiple languages or when using multiple compilers for the same language.

A complete ABI enables a program that supports an ABI to run without modification on multiple operating systems that provide the ABI. The target system must provide any required libraries (that implement the ABI), and there may be other prerequisites.

Description

Interface aspects covered by an ABI include:

  • Processor instruction set, with details like register file structure, memory access types, etc.
  • Size, layout, and alignment of basic data types that the processor can directly access
  • Calling convention, which controls how the arguments of functions are passed, and return values retrieved; for example, it controls the following:
    • How the call stack is organized
    • Whether all parameters are passed on the call stack, or some are passed in registers
    • Which registers are used for which function parameters
    • Which registers should be preserved by the callee (restore its value if changed)
    • Whether the first function parameter passed on the call stack is pushed first or last
    • Whether the caller or callee is responsible for cleaning up the call stack after the function call
  • Stack unwinding (setjmp/longjmp)
  • Name mangling, or how an API entity is named in the resulting object file (not in C)
  • Exception propagation (not in C)
  • How an application should make system calls to the operating system, and if the ABI specifies direct system calls rather than procedure calls to system call stubs, the system call numbers
  • In the case of a complete operating system ABI, the binary format of object files, program libraries, etc.

Example ABIs include the obsolete Intel Binary Compatibility Standard (iBCS),, the System V Release 4 ABIs for various instruction set architectures (ISAs) used by many Unix-like systems, and the Microsoft Windows ABIs for various ISAs.

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Computing and communication