how is the function ,not having its implement ,to work?-Collection of common programming errors

Hello fengshuiyue,

1. If you are referring to the Windows APIs (e.g. MessageBox(), CreateWindow(), etc), these are implemented in binary code already inside DLLs. The main Windows DLLs are kernel32.dll, user32.dll and gdi32.dll but there are many others.

2. During compilation, your program uses the declaration of these APIs in the header to properly make calls to them. The compiler uses the declaration in the header to ensure that the function name and parameter types are used correctly.

3. Then during linking, the linker uses something known as import libraries (there will be one for each system DLL : e.g. there is a User32.lib for User32.dll) to produce an executable file for your application so that calls to the system DLL APIs are resolved even though you do not have the source codes for these APIs.

4. At runtime, when your program starts up, the system DLLs (kernel32.dll, user32.dll and gdi32.dll and others) will be loaded for your application.

5. When your program makes a function call to MessageBox() for example, the actual code for this function, which is stored inside user32.dll, is executed. It is the linker which ensured that your application binary code (i.e. your .exe file) contains and uses the correct memory addresses of the APIs that you call.

– Bio.