Take the 2-minute tour ×

I am new to linux system programming and I came across API and ABI while reading Linux System Programming.

Definition of API :

An API defines the interfaces by which one piece of software communicates with another at the source level.

Definition of ABI :

Whereas an API defines a source interface, an ABI defines the low-level binary interface between two or more pieces of software on a particular architecture. It defines how an application interacts with itself, how an application interacts with the kernel, and how an application interacts with libraries.

How can a program communicate at a source level ? What is a source level ? Is it related to source code in anyway? Or the source of the library gets included in the main program ?

The only difference I know is API is mostly used by programmers and ABI is mostly used by compiler.

Sorry for the stupid question.


share|improve this question
by source level they mean something like include file to expose function definitions –  Anycorn Sep 24 '10 at 5:20
add comment

4 Answers

up vote 15 down vote accepted

The API is what humans use. We write source code. When we write a program and want to use some library function we write code like:

 long howManyDecibels = 123L;
 int ok = livenMyHills( howManyDecibels);

and we needed to know that there is a method livenMyHills(), which takes a long integer parameter. So as a Programming Interface it's all expressed in source code. The compiler turns this into executable instructions which conform to the implementation of this language on this particular operating system. And in this case result in some low level operations on an Audio unit. So particular bits and bytes are squirted at some hardware. So at runtime there's lots of Binary level action going on which we don't usually see.

share|improve this answer
Thanks for the example. –  Searock Sep 24 '10 at 7:30
add comment

API: Application Program Interface

This is the set of public types/variables/functions that you expose from your application/library.

In C/C++ this is what you expose in the header files that you ship with the application.

ABI: Application Binary Interface

This is how the compiler builds an application.
It defines things (but is not limited too):

  • How parameters are passed to functions (registers/stack).
  • Who cleans parameters from the stack (caller/callee).
  • Where the return value is placed for return.
  • How exceptions propagate.
share|improve this answer
This is probably the best concise explanation of what an ABI is, that I have ever seen; gj! –  TerryP Sep 24 '10 at 6:35
+1 Thanks for the detail explanation. –  Searock Sep 24 '10 at 7:29
You guys need to decide whether this answer is concise or detailed. :) –  jrok Feb 14 at 13:42
@jrok: Things can be concise and detailed they are not mutually exclusive. –  Loki Astari Feb 14 at 17:55
add comment

I mostly come across these terms in the sense of an API-incompatible change, or an ABI-incompatible change.

An API change is essentially where code that would have compiled with the previous version won't anymore. This can happen because you add an argument to a function, or change the name of something accessible outside of your local code. Any time you change a header, and it forces you to change something in a .c/.cpp file, you've made an API-change.

An ABI change is where code that has already been compiled against version 1 will no longer work with version 2 of a codebase (usually a library). This is generally trickier to keep track of than API incompatible change, since something as simple as adding a virtual method to a class can be ABI incompatible.

I've found two extremely useful resources for figuring out what ABI compatibility is and how to preserve it:

share|improve this answer
add comment

this is my layman explanations:

  • api - think include files. they provide programming interface
  • abi - think kernel module. when you run it on some kernel, they has to agree how to communicate without include files, ie as low-level binary interface
share|improve this answer
+1 Thanks for explaining the concept in layman terms : ) –  Searock Sep 24 '10 at 7:31
add comment

Your Answer


