Quote:
|
Originally Posted by linuxpimp20
so they aren't really similar but closely tied? An API is rules on how to use a library? Does that mean it is another layer between the library and program so the program is more modular and if it need to be ported to use a new library you just have to alter the API? thanks for your quick replies.
|
The API is, as the name states, the interface specification. It specifies how the application programmer should use the library and the behaviour of the library in reaction to calls. For a call to a function, pre-call states and post-call states are defined, parameter types, return types, events, error codes, etc. etc. It does not, in accordance with the 'black box' principle, explain what goes on INSIDE the library. This information should not be necessary, and if the library developer were to change the internal design, it could possibly be harmful.