Is there still a difference between a library and an API?

后端 未结 8 1653
清歌不尽
清歌不尽 2021-01-29 20:07

Whenever I ask people about the difference between an API and a library, I get different opinions. Some give this kind of definition, saying that an API is a spec and a library

相关标签:
8条回答
  • 2021-01-29 20:33

    we have first to define an interface ...

    Interface :is the means by which 2 "things" talk to each other and exchange information. "things" could be a (1) human or (2) a running code of any sort (e.g. library ,desktop application , OS , web service ... etc).

    if a human want to talks to a program he need Graphical user interface (GUI) or command line interface (CLI). both are types of interfaces that humans (but not programs) would like to use.

    if however a running code (of any sort) want to talk to another running code (of any sort) it doesn't need or want a GUI or CLI ,it rather need an Application Programming Interface (API).

    so to answer the original poster question : library is a type of running code and the API is the means by which this running code talk to other running codes.

    0 讨论(0)
  • 2021-01-29 20:40

    According to my perspective, whatever the functions are accessible to invoker , we can called as api in library file, library file having some of the functions which is private , we cannot access them ..

    0 讨论(0)
提交回复
热议问题