To resolve external references to DLLs, the linker simply adds information to the executable file that tells the system where to find the DLL code when the process starts up. Finding an external function in an import library informs the linker that the code for that function is in a DLL. The import library only contains code to load the DLL and to implement calls to functions in the DLL. To resolve this external reference, the application must link with the import library (.lib file) provided by the maker of the DLL. When the source code for the calling executable is compiled or assembled, the DLL function call generates an external function reference in the object code. Implicit linking occurs when an application's code calls an exported DLL function. There are advantages and disadvantages to each method. Whether to use implicit linking or explicit linking is an architectural decision you must make for your application. Furthermore, these methods aren't mutually exclusive one executable may implicitly link to a DLL, and another might attach to it explicitly. Explicit linking is sometimes referred to as dynamic load or run-time dynamic linking.Īn executable can use either linking method to link to the same DLL. Unlike calls to functions in a statically linked library or an implicitly linked DLL, the client executable must call the exported functions in an explicitly linked DLL through function pointers. It must also set up a function pointer to access each function it uses from the DLL. An executable that uses a DLL by explicit linking must explicitly load and unload the DLL. Implicit linking is sometimes referred to as static load or load-time dynamic linking.Įxplicit linking, where the operating system loads the DLL on demand at runtime. The client executable calls the exported functions of the DLL the same way as if the functions were statically linked and contained within the executable. Implicit linking, where the operating system loads the DLL at the same time as the executable that uses it. An executable file links to (or loads) a DLL in one of two ways:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |