---
title: Notes - 4. A*I
date: 1970-01-01T00:00:00.000Z
slug: notes-abiapi
---

### 4. ABI?

For me it wasnt clear enough about definition of ABI.

Application Binary Interface. Defines how data structures from machine code. System library / binary compatability. e.g. Data Type, Size, Layout, Alignment, ..

1. In Linux, `struct dirent{}` and corresponding of other OS differ. It is data structure mismatch, which is part of ABI. Also, typing like int, long may be 32bits, 64bits,,, though it usually doesnt differ in modern system.
2. Alignment of memory.
3. Calling convention ... How argument is passed. Via "eax, ebx, ecx..." or in stack? and also return values.
- System ABI, syscalls? ... syscall "int 0x80" is Linux's own ABI. Where is argument, syscall type indication where?
- Object code, shared libraries. ... Function call conventions, naming convention for shared object, may differ and thus mismatch?
1. Binary object format, ELF, PE, Mach-O is also part of ABI.
2. glibc, musl, ... this libc mismatch is also part of ABI incompatibility. Function signatures, syscall wrappers, symbol versioning, ...

API is just defining high-level approach of data exchange, ABI is more lower level approach of binary applications talk to each other via binary data structures and object conventions.

API read(fd, mode, bytes) can be same but where parameter is passed (in ASM level) may differ.

