The SDK is a combination of a series of files, including lib, dll, .h, documentation, examples, etc. The API is for the program, providing the interface for user programming, a series of modular classes and functions. The API can be considered to be included in the SDK.
After Windows is installed, the system has a simple SDK that contains a complete set of basic Windows APIs. If you install VC or download a new SDK, you can use the richer Windows API.
The SDK is the abbreviation of Software Development Kit, which means "software development kit" in Chinese. This is a term with a wide coverage. It can be said that the collection of related documents, examples and tools that assist in the development of a certain type of software can be called "SDK". Specific to our series of tutorials, we will only discuss a subset of the generalized SDK -- the SDK used to develop applications for the Windows platform.
To explain more clearly what the SDK is, we will introduce concepts such as APIs, dynamic link libraries, import libraries, and more.
The first thing to touch is the "API", which is the Application Programming Interface. It is actually a call interface left by the operating system to the application. The application calls the operating system's API to make the operating system execute the application's commands (actions). In fact, as early as the DOS era, there is the concept of API, but the API at that time is provided in the form of interrupt call (INT 21h). Applications running under DOS use operating system functions directly or indirectly through interrupt calls. For example, if AH is set to 30h and INT 21h is called, the version number of the DOS operating system can be obtained. In Windows, the system API is provided as a function call. Also get the version number of the operating system. All you have to do in Windows is to call the GetVersionEx() function. It can be said that the DOS API is "Thinking in Assembly Language" and the Windows API is "Thinking in High-Level Language". The DOS API is part of the system program. They are loaded into the memory along with the system and can find their entry through the interrupt vector table. So the Windows API? To illustrate the problem, we have to introduce the concept we want to introduce below-- DLL.
DLL (an acronym, I feel that the IT industry has a lot of three initials), namely the Dynamic Link Library. We often see files in .dll format, which are dynamic link library files, and are actually an executable file format. Unlike .exe files, .dll files cannot be executed directly. They are usually loaded by .exe at execution time and contain some resources and executable code. In fact, the three major modules of Windows are provided in the form of DLL (Kernel32.dll, User32.dll, GDI32.dll), which contains the execution code of the API function. In order to use the API functions in the DLL, we must have a declaration of the API function (.H) and its import library (.LIB). The prototype declaration of the function is not difficult to understand, so what is the import library used for? The first thing to understand is that the import library is used to find the entry point of the API in the DLL.
So, in order to use API functions, we have .H and .LIB files that correspond to the API, and the SDK provides a complete "toolkit" for developing the relevant files, examples, and tools needed for Windows applications. At this point, we really explained the meaning of the SDK.
Since the SDK contains the necessary information to use the API, people often use the API to write Windows applications as "SDK programming." The API and SDK are necessary for developing Windows applications, so other programming frameworks and libraries are built on top of them, such as VCL and MFC, although they have a higher degree of abstraction than "SDK programming". , but this does not prevent them from calling the API function directly when needed.