What is ABI? Does it have any relationship with API?

5

I'm reading this answer because I am currently studying C ++. I was trying to understand the difference C and C ++.

In the quoted answer, I came across the term ABI. Until then I knew about API, but ABI I had never heard of such a term.

  • What does ABI stand for?

  • Is there any relationship between ABI and API?

asked by anonymous 04.03.2017 / 23:50

1 answer

5
ABI, Application Binary Interface does not have a direct relationship with API , but it has some similarity.

>

Just as the API is the way codes communicate through source , the ABI is how codes communicate through the target . The API is about what the compiler gets to work, the ABI is about what it issues to run.

As the API is about specifying how communication should occur with your code, ABI is the specification of how communication should occur internally in the executable.

The specification determines:

  • size and arrangement of data
  • function call convention, where arguments are passed, which goes by register and which by stack, and how
  • how the OS function calls should occur
  • binary code format.

It only makes sense to understand ABI in languages that generate native code and communicate with other compilers, in the same or different languages, or have direct access to the operating system. If they generate different ABI compiler codes they probably will not be able to talk directly and require some intermediation. So some things will always have to call a DLL.

In the Wikipedia article has an image that best shows this relationship:

    
05.03.2017 / 00:01