ABI vs API

来源:互联网 发布:ubuntu ftp服务器 编辑:程序博客网 时间:2024/05/19 15:23

application programming interfaces (APIs), which similarly define interfaces between program components, but at the source code level.
是源代码级别的,每次都要编译

ABIs (which may or may not be officially standardized) is usually the job of the compiler, OS or library writer, but application programmers may have to deal with ABIs directly when writing programs in a mix of programming languages, using foreign function call interfaces between them.
是binary级别的,如果两个componnet是ABI兼容的话,是可以直接调用的,不需要编译;但是如是不兼容的话,就需要从新编译两者了

ABIs cover details such as:

  • a processor instruction set (with details like register file structure, stack organization, memory access types, …)
  • the sizes, layout, and alignment of basic data types the processor can directly access
  • the calling convention, which controls how functions’ arguments are passed and return values retrieved; for example, whether all parameters are passed on the stack or some are passed in registers, which registers are used for which function parameters, and whether the first function parameter passed on the stack is pushed first or last onto the stack
  • how an application should make system calls to the operating system and, if the ABI specifies direct system calls rather than procedure calls to system call stubs, the system call numbers
  • and in the case of a complete operating system ABI, the binary format of object files, program libraries and so on.

https://en.wikipedia.org/wiki/Application_binary_interface

原创粉丝点击