Sunday, July 12, 2009

What's the difference between an API and a library, such as iostream?

What's the difference between, say, the Windows API and a library or whatever they're called (a library, I think) such as iostream? (I'm programming in C++ by the way.) Thanks.

What's the difference between an API and a library, such as iostream?
A library is a series of ready built functions you can utilise, so rather that having to type in a load of commands every time you simply select the library function and fill in the parameters such as :





CreateWindow(SizeX,SizeY,Bordercolor, WindowColor)





An API Applications Programmer Interface) is a gateway in to a program or operating system. So if you had a terminal emulator program that loaded in two halves such as Terminal.exe (user interface) and kernel.exe (the kernel of the operational part of the program) when kernel.exe loaded you could talk to it via its API, usually via a software interrupt. Such as -





INT Kernel (Function number, parameter).
Reply:An API is an Application Programer's Interface. It's a collection of functions that access a library or a set of objects or a compiler or an OS. A library is also a set of functions, but one that adds functionality.





But in the real world, often the terms are used interchangeably.


No comments:

Post a Comment