Debugging and viewing of the library of VC ++ dynamic link library (DLL) Programming
Before entering the detailed description of various DLL types, it is necessary to introduce the debugging and viewing methods of library files, because we will face a large number of example projects from the next section.
Because the library files cannot be executed separately, when you press F5 (start debug mode execution) or CTRL + F5 (run) for execution, the dialog box shown in 3 is displayed, the user is required to enter the path of the executable file to start the execution of the library function. At this time, we can debug the library by entering the path of the EXE file to call the library. The debugging skills are the same as that of common application projects.
There is usually a better way to debug than the above practice, that is, place the library project and application project (the project that calls the Library) in the same VC work zone, and only debug the application project, set a breakpoint at the statement of the function in the application project call library, and press F11 after execution, so that the function in the library is entered in a single step. The libTest and libCall projects in section 2nd are placed in the same workspace, as shown in project structure 4.
The above debugging method is the same for static and dynamic link libraries. Therefore, all the source code provided for download in this article contains the Library Project and the call library project, both of which are included in a work zone, which is the intention of the author to provide such package download.
The export interface in the dynamic link library can be viewed using the Depends tool of Visual C ++. Let's use Depends to open user32.dll in the system directory, right? There are several versions of MessageBox in the red circle! It actually exists here. It turns out to be here!
Of course, the Depends tool can also display the DLL hierarchy. If you use it to open an executable file, you can see which DLL is called by this executable file.