File dll là gì

  -  

Feedbachồng will be sent to hoidapthutuchaiquan.vn: By pressing the submit button, your feedback will be used lớn improve sầu hoidapthutuchaiquan.vn products & services. Privacy policy.

Bạn đang xem: File dll là gì


In this article

This article describes what a dynamic link library (DLL) is and the various issues that may occur when you use DLLs. It also describes some advanced issues that you should consider when developing your own DLLs.

Applies to: Windows 10 - all editionsOriginal KB number: 815065

Summary

In describing what a DLL is, this article describes dynamic linking methods, DLL dependencies, DLL entry points, exporting DLL functions, and DLL troubleshooting tools.

This article finishes with a high-màn chơi comparison of DLLs khổng lồ the hoidapthutuchaiquan.vn .NET Framework assemblies.

For the Windows operating systems, much of the functionality of the operating system is provided by DLL. Additionally, when you run a program on one of these Windows operating systems, much of the functionality of the program may be provided by DLLs. For example, some programs may contain many different modules, và each module of the program is contained & distributed in DLLs.

The use of DLLs helps promote modularization of code, code reuse, efficient memory usage, & reduced disk space. So, the operating system and the programs load faster, run faster, and take less disk space on the computer.

When a program uses a DLL, an issue that is called dependency may cause the program not lớn run. When a program uses a DLL, a dependency is created. If another program overwrites & breaks this dependency, the original program may not successfully run.

With the introduction of the .NET Framework, most dependency problems have been eliminated by using assemblies.

More information

A DLL is a library that contains code và data that can be used by more than one program at the same time. For example, in Windows operating systems, the Comdlg32 DLL performs comtháng dialog box related functions. Each program can use the functionality that is contained in this DLL lớn implement an Open dialog box. It helps promote code reuse & efficient memory usage.

By using a DLL, a program can be modularized inlớn separate components. For example, an accounting program may be sold by module. Each module can be loaded inkhổng lồ the main program at run time if that module is installed. Because the modules are separate, the load time of the program is faster. And a module is only loaded when that functionality is requested.

Additionally, updates are easier to apply lớn each module without affecting other parts of the program. For example, you may have sầu a payroll program, and the tax rates change each year. When these changes are isolated khổng lồ a DLL, you can apply an update without needing to lớn build or install the whole program again.

The following menu describes some of the files that are implemented as DLLs in Windows operating systems:

ActiveX Controls (.ocx) files

An example of an ActiveX control is a calendar control that lets you select a date from a calendar.

Control Panel (.cpl) files

An example of a .cpl file is an sản phẩm that is located in Control Panel. Each sản phẩm is a specialized DLL.

Device driver (.drv) files

An example of a device driver is a printer driver that controls the printing khổng lồ a printer.

DLL advantages

The following danh mục describes some of the advantages that are provided when a program uses a DLL:

Uses fewer resources

When multiple programs use the same library of functions, a DLL can reduce the duplication of code that is loaded on the disk và in physical memory. It can greatly influence the performance of not just the program that is running in the foreground, but also other programs that are running on the Windows operating system.

Promotes modular architecture

A DLL helps promote developing modular programs. It helps you develop large programs that require multiple language versions or a program that requires modular architecture. An example of a modular program is an accounting program that has many modules that can be dynamically loaded at run time.

Eases deployment and installation

When a function within a DLL needs an update or a fix, the deployment and installation of the DLL does not require the program lớn be relinked with the DLL. Additionally, if multiple programs use the same DLL, the multiple programs will all benefit from the update or the fix. This issue may more frequently occur when you use a third-tiệc nhỏ DLL that is regularly updated or fixed.

DLL dependencies

When a program or a DLL uses a DLL function in another DLL, a dependency is created. The program is no longer self-contained, and the program may experience problems if the dependency is broken. For example, the program may not run if one of the following actions occurs:

A dependent DLL is upgraded to lớn a new version.A dependent DLL is fixed.A dependent DLL is overwritten with an earlier version.A dependent DLL is removed from the computer.

These actions are known as DLL conflicts. If backward compatibility is not enforced, the program may not successfully run.

Xem thêm: Time New Bank ( Tnb Official (@Timenewbank) · Twitter, Time New Bank (Tnb) Price To Usd

The following danh sách describes the changes that have sầu been introduced in Windows 2000 & in later Windows operating systems to lớn help minimize dependency issues:

Windows File Protection

In Windows File Protection, the operating system prevents system DLLs from being updated or deleted by an unauthorized agent. When a program installation tries to lớn remove sầu or update a DLL that is defined as a system DLL, Windows File Protection will look for a valid digital signature.

Private DLLs

Private DLLs let you isolate a program from changes that are made to lớn shared DLLs. Private DLLs use version-specific information or an empty .local tệp tin to enforce the version of the DLL that is used by the program. To use private DLLs, locate your DLLs in the program root folder. Then, for new programs, add version-specific information to lớn the DLL. For old programs, use an empty .local tệp tin. Each method tells the operating system lớn use the private DLLs that are located in the program root thư mục.

DLL troubleshooting tools

Several tools are available lớn help you troubleshoot DLL problems. The following tools are some of these tools.

Dependency Walker

The Dependency Walker tool can recursively scan for all dependent DLLs that are used by a program. When you open a program in Dependency Walker, Dependency Walker does the following checks:

Dependency Walker checks for missing DLLs.Dependency Walker checks for program files or DLLs that are not valid.Dependency Walker checks that import functions và export functions match.Dependency Walker checks for circular dependency errors.Dependency Walker checks for modules that are not valid because the modules are for a different operating system.

By using Dependency Walker, you can document all the DLLs that a program uses. It may help prsự kiện and correct DLL problems that may occur in the future. Dependency Walker is located in the following directory when you install Visual Studio 6.0:

driveProgram Fileshoidapthutuchaiquan.vn Visual StudioCommonTools

DLL Universal Problem Solver

The DLL Universal Problem Solver (DUPS) tool is used to lớn audit, compare, document, và display DLL information. The following list describes the utilities that Cosplay the DUPS tool:

Dlister.exe

This utility enumerates all the DLLs on the computer and logs the information to a text file or to a database file.

Dcomp.exe

This utility compares the DLLs that are listed in two text files and produces a third text tệp tin that contains the differences.

Dtxt2DB.exe

This utility loads the text files that are created by using the Dlister.exe cộ utility and the Dcomp.exe utility inlớn the dllHell database.

DlgDtxt2DB.exe

This utility provides a graphical user interface (GUI) version of the Dtxt2DB.exe utility.

DLL Help database

The DLL Help database helps you locate specific versions of DLLs that are installed by hoidapthutuchaiquan.vn software products.

DLL development

This section describes the issues & the requirements that you should consider when you develop your own DLLs.

Types of DLLs

When you load a DLL in an application, two methods of linking let you Call the exported DLL functions. The two methods of linking are load-time dynamic linking và run-time dynamic linking.

Load-time dynamic linking

In load-time dynamic linking, an application makes explicit calls khổng lồ exported DLL functions lượt thích local functions. To use load-time dynamic linking, provide a header (.h) file and an import library (.lib) tệp tin when you compile and links the application. When you bởi this, the linker will provide the system with the information that is required lớn load the DLL & resolve the exported DLL function locations at load time.

Run-time dynamic linking

In run-time dynamic linking, an application calls either the LoadLibrary function or the LoadLibraryEx function to lớn load the DLL at run time. After the DLL is successfully loaded, you use the GetProcAddress function khổng lồ obtain the address of the exported DLL function that you want lớn gọi. When you use run-time dynamic linking, you bởi not need an import library file.

The following list describes the application criteria for when to lớn use load-time dynamic linking & when to use run-time dynamic linking:

Startup performance

If the initial startup performance of the application is important, you should use run-time dynamic linking.

Ease of use

In load-time dynamic linking, the exported DLL functions are lượt thích local functions. This makes it easy for you to hotline these functions.

Application logic

In run-time dynamic linking, an application can branch khổng lồ load different modules as required. It is important when you develop multiple-language versions.

The DLL entry point

When you create a DLL, you can optionally specify an entry point function. The entry point function is called when processes or threads attach themselves to lớn the DLL or detached themselves from the DLL. You can use the entry point function to initialize data structures or to destroy data structures as required by the DLL. Additionally, if the application is multithreaded, you can use thread local storage (TLS) lớn allocate memory that is private lớn each thread in the entry point function. The following code is an example of the DLL entry point function.

BOOL APIENTRY DllMain(HANDLE hModule,// Handle khổng lồ DLL moduleDWORD ul_reason_for_hotline,// Reason for calling functionLPVOID lpReserved ) // Reserved switch ( ul_reason_for_hotline ) case DLL_PROCESS_ATTACHED: // A process is loading the DLL. break; case DLL_THREAD_ATTACHED: // A process is creating a new thread. break; case DLL_THREAD_DETACH: // A thread exits normally. break; case DLL_PROCESS_DETACH: // A process unloads the DLL. break; return TRUE;When the entry point function returns a FALSE value, the application will not start if you are using load-time dynamic linking. If you are using run-time dynamic linking, only the individual DLL will not load.

Xem thêm: Chụp Cộng Hưởng Từ ( Cht Là Gì ? Từ Điển Anh Việt Call Holding Time (Cht) Là Gì

The entry point function should only perform simple initialization tasks và should not Call any other DLL loading or termination functions. For example, in the entry point function, you should not directly or indirectly Hotline the LoadLibrary function or the LoadLibraryEx function. Additionally, you should not Hotline the FreeLibrary function when the process is terminating.