title: What is an application binary interface (ABI)?
body: <p>I never clearly understood what an ABI is. Please don't point me to a Wikipedia article. If I could understand it, I wouldn't be here posting such a lengthy post.</p>
  
  <p>This is my mindset about different interfaces:</p>
  
  <p>A TV remote is an interface between the user and the TV. It is an existing entity, but useless (doesn't provide any functionality) by itself. All the functionality for each of those buttons on the remote is implemented in the television set.</p>
  
  <blockquote>
    <p><strong>Interface:</strong> It is an "existing entity" layer between the
    <code>functionality</code> and <code>consumer</code> of that functionality. An interface by itself
    doesn't do anything. It just invokes the functionality lying behind.</p>
    
    <p>Now depending on who the user is there are different type of interfaces.</p>
    
    <p><strong>Command Line Interface (CLI)</strong> commands are the existing entities,
    the consumer is the user and functionality lies behind.</p>
    
    <p><code>functionality:</code> my software functionality which solves some
    purpose to which we are describing this interface.</p>
    
    <p><code>existing entities:</code> commands</p>
    
    <p><code>consumer:</code> user</p>
    
    <p><strong>Graphical User Interface(GUI)</strong> window, buttons, etc. are the existing
    entities, and again the consumer is the user and functionality lies behind.</p>
    
    <p><code>functionality:</code> my software functionality which solves some problem to which we are describing this interface.</p>
    
    <p><code>existing entities:</code> window, buttons etc..</p>
    
    <p><code>consumer:</code> user</p>
    
    <p><strong>Application Programming Interface(API)</strong> functions (or to be
    more correct) interfaces (in interfaced based programming) are the
    existing entities, consumer here is another program not a user, and again
    functionality lies behind this layer.</p>
    
    <p><code>functionality:</code> my software functionality which solves some
    problem to which we are describing this interface.</p>
    
    <p><code>existing entities:</code> functions, Interfaces (array of functions).</p>
    
    <p><code>consumer:</code> another program/application.</p>
    
    <p><strong>Application Binary Interface (ABI)</strong> Here is where my problem starts.</p>
    
    <p><code>functionality:</code> ???</p>
    
    <p><code>existing entities:</code> ???</p>
    
    <p><code>consumer:</code> ???</p>
  </blockquote>
  
  <ul>
  <li>I've written software in different languages and provided different kinds of interfaces (CLI, GUI, and API), but I'm not sure if I have ever provided any ABI.</li>
  </ul>
  
  <p><a href="http://en.wikipedia.org/wiki/Application_binary_interface" rel="noreferrer">Wikipedia says:</a></p>
  
  <blockquote>
    <p>ABIs cover details such as</p>
    
    <ul>
    <li>data type, size, and alignment;</li>
    <li>the calling convention, which controls how functions' arguments are
    passed and return values retrieved;</li>
    <li>the system call numbers and how an application should make system calls
    to the operating system;</li>
    </ul>
    
    <p>Other ABIs standardize details such as</p>
    
    <ul>
    <li>the C++ name mangling,</li>
    <li>exception propagation, and</li>
    <li>calling convention between compilers on the same platform, but do
    not require cross-platform compatibility.</li>
    </ul>
  </blockquote>
  
  <ul>
  <li><p>Who needs these details? Please don't say the OS. I know assembly programming. I know how linking &amp; loading works. I know exactly what happens inside.</p></li>
  <li><p>Why did C++ name mangling come in? I thought we are talking at the binary level. Why do languages come in?</p></li>
  </ul>
  
  <p>Anyway, I've downloaded the <a href="http://www.sco.com/developers/devspecs/gabi41.pdf" rel="noreferrer">[PDF] System V Application Binary Interface <em>Edition 4.1 (1997-03-18)</em></a> to see what exactly it contains. Well, most of it didn't make any sense.</p>
  
  <ul>
  <li><p>Why does it contain two chapters (4th &amp; 5th) to describe the <a href="http://en.wikipedia.org/wiki/Executable_and_Linkable_Format" rel="noreferrer">ELF</a> file format? In fact, these are the only two significant chapters of that specification. The rest of the chapters are "processor specific". Anyway, I though that it is a completely different topic. Please don't say that ELF file format specifications <em>are</em> the ABI. It doesn't qualify to be an <em>interface</em> according to the definition.</p></li>
  <li><p>I know, since we are talking at such a low level it must be very specific. But I'm not sure how is it "instruction set architecture (ISA)" specific?</p></li>
  <li><p>Where can I find Microsoft Windows' ABI?</p></li>
  </ul>
  
  <p>So, these are the major queries that are bugging me.</p>