What is ABI? Does it have anything to do with API?

Asked

Viewed 494 times

7

I am reading that 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 such a term.

  • What ABI means?

  • Is there any relationship between ABI and API?

  • i don’t know right but ABI has the interface of how to mount the frame to call an external function.

1 answer

7


ABI, Application Binary Interface has no direct relationship with API, but bears some resemblance.

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

Just as the API is about specifying how communication should occur with your code, the ABI is specifying how communication should occur internally in the executable.

The specification determines:

  • data size and layout
  • function call convention, where arguments are passed, which go by register and which by stack, and how
  • how operational system functions calls should occur
  • the format of the binary code.

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

In the wikipedia article has an image that shows this relationship better:

ABI x API

There is the use of API in another context, and even a lot of people think it’s just this one, but I think it’s a different context than what’s here.

  • 2

    I couldn’t explain it better.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.