DLL file Function

Source: Internet
Author: User

DLL files are dynamic library files. They are executable files that allow programs to share the code and other resources necessary to execute special tasks. The DLL file provided by Windows contains many functions and resources that allow Windows-based programs to operate in windows.

In most cases, a DLL is a file with a dll extension, but it may also be an EXE or another extension. They provide code, data, or functions to programs running in windows. The program can open, enable, query, disable, and close the driver according to the commands in the DLL file.

Dll can be found in the "C: Windows" directory "C: Windowssystem" directory and the installation directory of the program. If the program is started but one or more DLL files are lost or destroyed, an error message is received, for example, "XYZ. dll cannot be found ". If the started program contains an expired DLL file or unmatched DLL file, the "undefined Dynamic Link call" message will appear. In this case, you can find the correct DLL file on another computer and copy it to the appropriate directory to run the program correctly.

Large applications are composed of many modules that complete relatively independent functions and collaborate with each other to complete the work of the entire software system. Some modules may have common functions 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 occur: one drawback is that the size of the application is increased, it occupies more disk space and consumes a large amount of memory space during program running, resulting in a waste of system resources. Another drawback is that when writing large EXE programs, all source code must be adjusted during each modification and reconstruction, which increases the complexity of the compilation process and is not conducive to periodic unit tests.

Windows provides a completely different and effective programming and running environment. You can create an independent program module as a smaller DLL (Dynamic linkable Library) file, they can be compiled and tested separately. During runtime, the system will load the EXE program to the memory space only when it does need to call these DLL modules. This method not only reduces the size of the EXE file and the need for memory space, but also enables 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.

In general, a DLL is a disk file. dll,. DRV,. Fon,. sys, and many system files with. EXE extension can be DLL. It consists of global data, service functions, and resources. It is loaded into the virtual space of the process at runtime and becomes part of the calling process. If there is no conflict with other DLL, the file is usually mapped to the same address of the virtual space of the process. The DLL module contains various export functions to provide external services. A dll can have its own data segment but does not have its own stack. It uses the same stack mode as the application that calls it. a dll has only one instance in the memory; DLL implements code encapsulation. dll compilation is independent of the specific programming language and compiler.

In the Win32 environment, each process copies its own read/write global variables. To share memory with other processes, you must use a memory ing file or declare a shared data segment. The stack memory required by the DLL module is allocated from the stack of the running process. When Windows loads the DLL module, it matches the process function call with the export function of the DLL file. In Windows, the DLL operation only maps the DLL to the virtual address space of the process that requires it. Any object (including variables) created by the code in the DLL function is owned by the thread or process that calls it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.