What is an application binary interface (ABI)?

后端 未结 16 1740
情歌与酒
情歌与酒 2020-11-22 11:41

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.

16条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 12:23

    I was also trying to understand ABI and JesperE’s answer was very helpful.

    From a very simple perspective, we may try to understand ABI by considering binary compatibility.

    KDE wiki defines a library as binary compatible “if a program linked dynamically to a former version of the library continues running with newer versions of the library without the need to recompile.” For more on dynamic linking, refer Static linking vs dynamic linking

    Now, let’s try to look at just the most basic aspects needed for a library to be binary compatibility (assuming there are no source code changes to the library):

    1. Same/backward compatible instruction set architecture (processor instructions, register file structure, stack organization, memory access types, along with sizes, layout, and alignment of basic data types the processor can directly access)
    2. Same calling conventions
    3. Same name mangling convention (this might be needed if say a Fortran program needs to call some C++ library function).

    Sure, there are many other details but this is mostly what the ABI also covers.

    More specifically to answer your question, from the above, we can deduce:

    ABI functionality: binary compatibility

    existing entities: existing program/libraries/OS

    consumer: libraries, OS

    Hope this helps!

提交回复
热议问题