I learned Arrays, Functions, Pointers, Classes and Structures. Now I am ready to move on. My question is, What is the difference between a DLL and an API, and how does one access a DLL in a C++ program? Can someone give an example on how to do it please? and why would anybody want to do this?


Recommended Answers

All 2 Replies

API (Application Program Inerface) allows your program to access operating system functions, or functions in a library that may have been written by someone else. For example, the functions sleep(1000), a *nix API function, and Sleep(1000), a MS-Windows function (note spelling capatilization differences). They may be implemented in either a DLL (MS-Windows), shared library (*nix version of a dll), or a statically linked library (both MS-Windows and *nix have them).

Short anwer: a DLL contains pre-compiled implementation code for API functions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.