DLL refers to a dynamic link library, an executable file that allows programs to share code and other resources needed to perform special tasks. In Windows, many applications are not a complete executable file. They are divided into some relatively independent dynamic link libraries, that is, DLL files, which are placed in the system. An application can have multiple DLL files, and a DLL file may be shared by several applications. Such DLL files are called shared DLL files.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
DLL is the abbreviation of Dynamic Link Library, which means dynamic link library. It is also called application extension; it is an executable file that allows programs to share the code needed to perform special tasks. and other resources.
In Windows, many applications are not a complete executable file. They are divided into some relatively independent dynamic link libraries, that is, DLL files, which are placed in the system. When we execute a program, the corresponding DLL file will be called. An application can have multiple DLL files, and a DLL file may be shared by several applications. Such DLL files are called shared DLL files.
#DLL files allow programs to share code and other resources necessary to perform special tasks. Larger applications are composed of many modules. These modules complete relatively independent functions. They cooperate with each other to complete the work of the entire software system. There may be some modules whose functions are more general and will still be used when constructing other software systems. When constructing a software system, if the source code of all modules is statically compiled into the entire application EXE file, some problems will arise: One disadvantage is that it increases the size of the application, which takes up more disk space and the program runs It will also consume a large amount of memory space, causing a waste of system resources; another disadvantage is that when writing a large EXE program, all source codes must be adjusted and compiled every time it is modified and rebuilt, which increases the complexity of the compilation process. , which is also not conducive to staged unit testing.
The Windows system platform provides a completely different and more effective programming and running environment. You can create independent program modules as smaller DLL files, and compile and test them separately. At runtime, the system will load these DLL modules into the memory space only if the EXE program really wants to call them. This approach not only reduces the size of the EXE file and the memory space requirements, but also allows these DLL modules to be used by multiple applications at the same time. Windows itself implements some major system functions in the form of DLL modules.
Generally speaking, a DLL is a disk file. System files with .dll, .DRV, .FON, .SYS and many .EXE extensions can be DLLs. It consists of global data, service functions and resources. It is loaded into the virtual space of the calling process by the system at runtime and becomes part of the calling process. If there are no conflicts with other DLLs, the file is usually mapped to the same address in the process's virtual space. The DLL module contains various exported functions for providing services to the outside world. A DLL can have its own data segment, but does not have its own stack, and uses the same stack mode as the application that calls it; a DLL has only one instance in the memory; the DLL implements code encapsulation; the preparation of the DLL is related to the specific programming language It has nothing to do with the compiler.
In a Win32 environment, each process copies its own read/write global variables. If you want to share memory with other processes, you must use a memory mapped file or declare a shared data segment. The stack memory required by DLL modules is allocated from the stack of the running process. Windows matches process function calls to the DLL file's exported functions when it loads a DLL module. The operation of the Windows operating system on the DLL is only to map the DLL into the virtual address space of the process that needs it. Any objects (including variables) created by code within a DLL function are owned by the thread or process that calls it.
Advantages of DLL
When a program uses a DLL, it has the following advantages: Uses fewer resources. When multiple programs use the same function library, the DLL can reduce the amount of duplication of code loaded in disk and physical memory. This can greatly affect not only programs running in the foreground, but also other programs running on the Windows operating system. Promoting modular architecture DLLs can help promote the development of modular programs. This can help you develop large programs that require multiple language versions or programs that require a modular architecture. An example of a modular program is an accounting program that has multiple modules that can be loaded dynamically at runtime. Simplified Deployment and Installation When functions in a DLL need to be updated or repaired, deploying and installing a DLL does not require re-establishing the program's link to the DLL. Additionally, if multiple programs use the same DLL, then multiple programs will benefit from the update or fix. This problem may occur more frequently when you use third-party DLLs that are regularly updated or fixed.
For more related knowledge, please visit the FAQ column!
The above is the detailed content of What does dll file mean?. For more information, please follow other related articles on the PHP Chinese website!