{
	"id": "f1188495-4e8c-44d7-9b38-6e907298523e",
	"created_at": "2026-04-06T00:08:41.646018Z",
	"updated_at": "2026-04-10T13:11:41.839632Z",
	"deleted_at": null,
	"sha1_hash": "b7a2f1027b23ff732d454446893f3fba1f627249",
	"title": "Dynamic link library (DLL) - Windows Client",
	"llm_title": "",
	"authors": "",
	"file_creation_date": "0001-01-01T00:00:00Z",
	"file_modification_date": "0001-01-01T00:00:00Z",
	"file_size": 95513,
	"plain_text": "Dynamic link library (DLL) - Windows Client\r\nBy kaushika-msft\r\nArchived: 2026-04-05 13:03:46 UTC\r\nThis article describes what a dynamic link library (DLL) is and the various issues that may occur when you use\r\nDLLs. It also describes some advanced issues that you should consider when developing your own DLLs.\r\nApplies to:   Windows 10 - all editions\r\nOriginal KB number:   815065\r\nSummary\r\nIn describing what a DLL is, this article describes dynamic linking methods, DLL dependencies, DLL entry\r\npoints, exporting DLL functions, and DLL troubleshooting tools.\r\nThis article finishes with a high-level comparison of DLLs to the Microsoft .NET Framework assemblies.\r\nFor the Windows operating systems, much of the functionality of the operating system is provided by DLL.\r\nAdditionally, when you run a program on one of these Windows operating systems, much of the functionality of\r\nthe program may be provided by DLLs. For example, some programs may contain many different modules, and\r\neach module of the program is contained and distributed in DLLs.\r\nThe use of DLLs helps promote modularization of code, code reuse, efficient memory usage, and reduced disk\r\nspace. So, the operating system and the programs load faster, run faster, and take less disk space on the computer.\r\nWhen a program uses a DLL, an issue that is called dependency may cause the program not to run. When a\r\nprogram uses a DLL, a dependency is created. If another program overwrites and breaks this dependency, the\r\noriginal program may not successfully run.\r\nWith the introduction of the .NET Framework, most dependency problems have been eliminated by using\r\nassemblies.\r\nMore information\r\nA DLL is a library that contains code and data that can be used by more than one program at the same time. For\r\nexample, in Windows operating systems, the Comdlg32 DLL performs common dialog box related functions.\r\nEach program can use the functionality that is contained in this DLL to implement an Open dialog box. It helps\r\npromote code reuse and efficient memory usage.\r\nBy using a DLL, a program can be modularized into separate components. For example, an accounting program\r\nmay be sold by module. Each module can be loaded into the main program at run time if that module is installed.\r\nBecause the modules are separate, the load time of the program is faster. And a module is only loaded when that\r\nfunctionality is requested.\r\nhttps://learn.microsoft.com/troubleshoot/windows-client/deployment/dynamic-link-library\r\nPage 1 of 10\n\nAdditionally, updates are easier to apply to each module without affecting other parts of the program. For\r\nexample, you may have a payroll program, and the tax rates change each year. When these changes are isolated to\r\na DLL, you can apply an update without needing to build or install the whole program again.\r\nThe following list describes some of the files that are implemented as DLLs in Windows operating systems:\r\nActiveX Controls (.ocx) files\r\nAn example of an ActiveX control is a calendar control that lets you select a date from a calendar.\r\nControl Panel (.cpl) files\r\nAn example of a .cpl file is an item that is located in Control Panel. Each item is a specialized DLL.\r\nDevice driver (.drv) files\r\nAn example of a device driver is a printer driver that controls the printing to a printer.\r\nDLL advantages\r\nThe following list describes some of the advantages that are provided when a program uses a DLL:\r\nUses fewer resources\r\nWhen multiple programs use the same library of functions, a DLL can reduce the duplication of code that\r\nis loaded on the disk and in physical memory. It can greatly influence the performance of not just the\r\nprogram that is running in the foreground, but also other programs that are running on the Windows\r\noperating system.\r\nPromotes modular architecture\r\nA DLL helps promote developing modular programs. It helps you develop large programs that require\r\nmultiple language versions or a program that requires modular architecture. An example of a modular\r\nprogram is an accounting program that has many modules that can be dynamically loaded at run time.\r\nEases deployment and installation\r\nWhen a function within a DLL needs an update or a fix, the deployment and installation of the DLL does\r\nnot require the program to be relinked with the DLL. Additionally, if multiple programs use the same DLL,\r\nthe multiple programs will all benefit from the update or the fix. This issue may more frequently occur\r\nwhen you use a third-party DLL that is regularly updated or fixed.\r\nDLL dependencies\r\nWhen a program or a DLL uses a DLL function in another DLL, a dependency is created. The program is no\r\nlonger self-contained, and the program may experience problems if the dependency is broken. For example, the\r\nprogram may not run if one of the following actions occurs:\r\nhttps://learn.microsoft.com/troubleshoot/windows-client/deployment/dynamic-link-library\r\nPage 2 of 10\n\nA dependent DLL is upgraded to a new version.\r\nA dependent DLL is fixed.\r\nA dependent DLL is overwritten with an earlier version.\r\nA dependent DLL is removed from the computer.\r\nThese actions are known as DLL conflicts. If backward compatibility is not enforced, the program may not\r\nsuccessfully run.\r\nThe following list describes the changes that have been introduced in Windows 2000 and in later Windows\r\noperating systems to help minimize dependency issues:\r\nWindows File Protection\r\nIn Windows File Protection, the operating system prevents system DLLs from being updated or deleted by\r\nan unauthorized agent. When a program installation tries to remove or update a DLL that is defined as a\r\nsystem DLL, Windows File Protection will look for a valid digital signature.\r\nPrivate DLLs\r\nPrivate DLLs let you isolate a program from changes that are made to shared DLLs. Private DLLs use\r\nversion-specific information or an empty .local file to enforce the version of the DLL that is used by the\r\nprogram. To use private DLLs, locate your DLLs in the program root folder. Then, for new programs, add\r\nversion-specific information to the DLL. For old programs, use an empty .local file. Each method tells\r\nthe operating system to use the private DLLs that are located in the program root folder.\r\nSeveral tools are available to help you troubleshoot DLL problems. The following tools are some of these tools.\r\nDependency Walker\r\nThe Dependency Walker tool can recursively scan for all dependent DLLs that are used by a program. When you\r\nopen a program in Dependency Walker, Dependency Walker does the following checks:\r\nDependency Walker checks for missing DLLs.\r\nDependency Walker checks for program files or DLLs that are not valid.\r\nDependency Walker checks that import functions and export functions match.\r\nDependency Walker checks for circular dependency errors.\r\nDependency Walker checks for modules that are not valid because the modules are for a different operating\r\nsystem.\r\nBy using Dependency Walker, you can document all the DLLs that a program uses. It may help prevent and\r\ncorrect DLL problems that may occur in the future. Dependency Walker is located in the following directory when\r\nyou install Visual Studio 6.0:\r\ndrive\\Program Files\\Microsoft Visual Studio\\Common\\Tools\r\nDLL Universal Problem Solver\r\nhttps://learn.microsoft.com/troubleshoot/windows-client/deployment/dynamic-link-library\r\nPage 3 of 10\n\nThe DLL Universal Problem Solver (DUPS) tool is used to audit, compare, document, and display DLL\r\ninformation. The following list describes the utilities that make up the DUPS tool:\r\nDlister.exe\r\nThis utility enumerates all the DLLs on the computer and logs the information to a text file or to a database\r\nfile.\r\nDcomp.exe\r\nThis utility compares the DLLs that are listed in two text files and produces a third text file that contains\r\nthe differences.\r\nDtxt2DB.exe\r\nThis utility loads the text files that are created by using the Dlister.exe utility and the Dcomp.exe utility\r\ninto the dllHell database.\r\nDlgDtxt2DB.exe\r\nThis utility provides a graphical user interface (GUI) version of the Dtxt2DB.exe utility.\r\nDLL Help database\r\nThe DLL Help database helps you locate specific versions of DLLs that are installed by Microsoft software\r\nproducts.\r\nDLL development\r\nThis section describes the issues and the requirements that you should consider when you develop your own\r\nDLLs.\r\nTypes of DLLs\r\nWhen you load a DLL in an application, two methods of linking let you call the exported DLL functions. The two\r\nmethods of linking are load-time dynamic linking and run-time dynamic linking.\r\nLoad-time dynamic linking\r\nIn load-time dynamic linking, an application makes explicit calls to exported DLL functions like local functions.\r\nTo use load-time dynamic linking, provide a header (.h) file and an import library (.lib) file when you compile and\r\nlink the application. When you do this, the linker will provide the system with the information that is required to\r\nload the DLL and resolve the exported DLL function locations at load time.\r\nRun-time dynamic linking\r\nhttps://learn.microsoft.com/troubleshoot/windows-client/deployment/dynamic-link-library\r\nPage 4 of 10\n\nIn run-time dynamic linking, an application calls either the LoadLibrary function or the LoadLibraryEx\r\nfunction to load the DLL at run time. After the DLL is successfully loaded, you use the GetProcAddress function\r\nto obtain the address of the exported DLL function that you want to call. When you use run-time dynamic linking,\r\nyou do not need an import library file.\r\nThe following list describes the application criteria for when to use load-time dynamic linking and when to use\r\nrun-time dynamic linking:\r\nStartup performance\r\nIf the initial startup performance of the application is important, you should use run-time dynamic linking.\r\nEase of use\r\nIn load-time dynamic linking, the exported DLL functions are like local functions. This makes it easy for\r\nyou to call these functions.\r\nApplication logic\r\nIn run-time dynamic linking, an application can branch to load different modules as required. It is\r\nimportant when you develop multiple-language versions.\r\nThe DLL entry point\r\nWhen you create a DLL, you can optionally specify an entry point function. The entry point function is called\r\nwhen processes or threads attach themselves to the DLL or detached themselves from the DLL. You can use the\r\nentry point function to initialize data structures or to destroy data structures as required by the DLL. Additionally,\r\nif the application is multithreaded, you can use thread local storage (TLS) to allocate memory that is private to\r\neach thread in the entry point function. The following code is an example of the DLL entry point function.\r\nBOOL APIENTRY DllMain(\r\nHANDLE hModule,// Handle to DLL module\r\nDWORD ul_reason_for_call,// Reason for calling function\r\nLPVOID lpReserved ) // Reserved\r\n{\r\n switch ( ul_reason_for_call )\r\n {\r\n case DLL_PROCESS_ATTACHED: // A process is loading the DLL.\r\n break;\r\n case DLL_THREAD_ATTACHED: // A process is creating a new thread.\r\n break;\r\n case DLL_THREAD_DETACH: // A thread exits normally.\r\n break;\r\n case DLL_PROCESS_DETACH: // A process unloads the DLL.\r\n break;\r\n }\r\nhttps://learn.microsoft.com/troubleshoot/windows-client/deployment/dynamic-link-library\r\nPage 5 of 10\n\nreturn TRUE;\r\n}\r\nWhen the entry point function returns a FALSE value, the application will not start if you are using load-time\r\ndynamic linking. If you are using run-time dynamic linking, only the individual DLL will not load.\r\nThe entry point function should only perform simple initialization tasks and should not call any other DLL loading\r\nor termination functions. For example, in the entry point function, you should not directly or indirectly call the\r\nLoadLibrary function or the LoadLibraryEx function. Additionally, you should not call the FreeLibrary\r\nfunction when the process is terminating.\r\nNote\r\nIn multithreaded applications, make sure that access to the DLL global data is synchronized (thread safe) to avoid\r\npossible data corruption. To do this, use TLS to provide unique data for each thread.\r\nExport DLL functions\r\nTo export DLL functions, you can either add a function keyword to the exported DLL functions or create a module\r\ndefinition (.def) file that lists the exported DLL functions.\r\nTo use a function keyword, you must declare each function that you want to export with the following keyword:\r\n__declspec(dllexport)\r\nTo use exported DLL functions in the application, you must declare each function that you want to import with the\r\nfollowing keyword: __declspec(dllimport)\r\nTypically, you would use one header file that has a define statement and an ifdef statement to separate the\r\nexport statement and the import statement.\r\nYou can also use a module definition file to declare exported DLL functions. When you use a module definition\r\nfile, you do not have to add the function keyword to the exported DLL functions. In the module definition file, you\r\ndeclare the LIBRARY statement and the EXPORTS statement for the DLL. The following code is an example of a\r\ndefinition file.\r\n// SampleDLL.def\r\n//\r\nLIBRARY \"sampleDLL\"\r\nEXPORTS HelloWorld\r\nSample DLL and application\r\nIn Visual C++ 6.0, you can create a DLL by selecting either the Win32 Dynamic-Link Library project type or\r\nthe MFC AppWizard (dll) project type.\r\nhttps://learn.microsoft.com/troubleshoot/windows-client/deployment/dynamic-link-library\r\nPage 6 of 10\n\nThe following code is an example of a DLL that was created in Visual C++ by using the Win32 Dynamic-Link\r\nLibrary project type.\r\n// SampleDLL.cpp\r\n//\r\n#include \"stdafx.h\"\r\n#define EXPORTING_DLL\r\n#include \"sampleDLL.h\"\r\nBOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved\r\n)\r\n{\r\n return TRUE;\r\n}\r\nvoid HelloWorld()\r\n{\r\n MessageBox( NULL, TEXT(\"Hello World\"), TEXT(\"In a DLL\"), MB_OK);\r\n}\r\n// File: SampleDLL.h\r\n//\r\n#ifndef INDLL_H\r\n #define INDLL_H\r\n #ifdef EXPORTING_DLL\r\n extern __declspec(dllexport) void HelloWorld();\r\n #else\r\n extern __declspec(dllimport) void HelloWorld();\r\n #endif\r\n#endif\r\nThe following code is an example of a Win32 Application project that calls the exported DLL function in the\r\nSampleDLL DLL.\r\n// SampleApp.cpp\r\n//\r\n#include \"stdafx.h\"\r\n#include \"sampleDLL.h\"\r\nint APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)\r\n{\r\n HelloWorld();\r\n return 0;\r\n}\r\nhttps://learn.microsoft.com/troubleshoot/windows-client/deployment/dynamic-link-library\r\nPage 7 of 10\n\nNote\r\nIn load-time dynamic linking, you must link the SampleDLL.lib import library that is created when you build the\r\nSampleDLL project.\r\nIn run-time dynamic linking, you use code that is similar to the following code to call the SampleDLL.dll\r\nexported DLL function.\r\n...\r\ntypedef VOID (*DLLPROC) (LPTSTR);\r\n...\r\nHINSTANCE hinstDLL;\r\nDLLPROC HelloWorld;\r\nBOOL fFreeDLL;\r\nhinstDLL = LoadLibrary(\"sampleDLL.dll\");\r\nif (hinstDLL != NULL)\r\n{\r\n HelloWorld = (DLLPROC) GetProcAddress(hinstDLL, \"HelloWorld\");\r\n if (HelloWorld != NULL)\r\n (HelloWorld);\r\n fFreeDLL = FreeLibrary(hinstDLL);\r\n}\r\n...\r\nWhen you compile and link the SampleDLL application, the Windows operating system searches for the\r\nSampleDLL DLL in the following locations in this order:\r\n1. The application folder\r\n2. The current folder\r\n3. The Windows system folder\r\nNote\r\nThe GetSystemDirectory function returns the path of the Windows system folder.\r\n4. The Windows folder\r\nNote\r\nThe GetWindowsDirectory function returns the path of the Windows folder.\r\nThe .NET Framework assembly\r\nWith the introduction of .NET and the .NET Framework, most of the problems that are associated with DLLs have\r\nbeen eliminated by using assemblies. An assembly is a logical unit of functionality that runs under the control of\r\nhttps://learn.microsoft.com/troubleshoot/windows-client/deployment/dynamic-link-library\r\nPage 8 of 10\n\nthe .NET common language runtime (CLR). An assembly physically exists as a .dll file or as an .exe file.\r\nHowever, internally an assembly is different from a Microsoft Win32 DLL.\r\nAn assembly file contains an assembly manifest, type metadata, Microsoft intermediate language (MSIL) code,\r\nand other resources. The assembly manifest contains the assembly metadata that provides all the information that\r\nis required for an assembly to be self-describing. The following information is included in the assembly manifest:\r\nAssembly name\r\nVersion information\r\nCulture information\r\nStrong name information\r\nThe assembly list of files\r\nType reference information\r\nReferenced and dependent assembly information\r\nThe MSIL code that is contained in the assembly cannot be directly executed. Instead, MSIL code execution is\r\nmanaged through the CLR. By default, when you create an assembly, the assembly is private to the application. To\r\ncreate a shared assembly requires that you assign a strong name to the assembly and then publish the assembly in\r\nthe global assembly cache.\r\nThe following list describes some of the features of assemblies compared to the features of Win32 DLLs:\r\nSelf-describing\r\nWhen you create an assembly, all the information that is required for the CLR to run the assembly is\r\ncontained in the assembly manifest. The assembly manifest contains a list of the dependent assemblies.\r\nTherefore, the CLR can maintain a consistent set of assemblies that are used in the application. In Win32\r\nDLLs, you cannot maintain consistency between a set of DLLs that are used in an application when you\r\nuse shared DLLs.\r\nVersioning\r\nIn an assembly manifest, version information is recorded and enforced by the CLR. Additionally, version\r\npolicies let you enforce version-specific usage. In Win32 DLLs, versioning can't be enforced by the\r\noperating system. You must make sure that DLLs are backward compatible.\r\nSide-by-side deployment\r\nAssemblies support side-by-side deployment. One application can use one version of an assembly, and\r\nanother application can use a different version of an assembly. Starting in Windows 2000, side-by-side\r\ndeployment is supported by locating DLLs in the application folder. Additionally, Windows File Protection\r\nprevents system DLLs from being overwritten or replaced by an unauthorized agent.\r\nSelf-containment and isolation\r\nAn application that is developed by using an assembly can be self-contained and isolated from other\r\napplications that are running on the computer. This feature helps you create zero-impact installations.\r\nhttps://learn.microsoft.com/troubleshoot/windows-client/deployment/dynamic-link-library\r\nPage 9 of 10\n\nExecution\r\nAn assembly is run under the security permissions that are supplied in the assembly manifest and that are\r\ncontrolled by the CLR.\r\nLanguage independent\r\nAn assembly can be developed by using any one of the supported .NET languages. For example, you can\r\ndevelop an assembly in Microsoft Visual C#, and then use the assembly in a Visual Basic .NET project.\r\nData collection\r\nIf you need assistance from Microsoft support, we recommend you collect the information by following the steps\r\nmentioned in Gather information by using TSS for deployment-related issues.\r\nReferences\r\nDeploying and Configuring Applications\r\nAssemblies\r\nRun-Time Dynamic Linking\r\nThread Local Storage\r\nSource: https://learn.microsoft.com/troubleshoot/windows-client/deployment/dynamic-link-library\r\nhttps://learn.microsoft.com/troubleshoot/windows-client/deployment/dynamic-link-library\r\nPage 10 of 10",
	"extraction_quality": 1,
	"language": "EN",
	"sources": [
		"MITRE"
	],
	"origins": [
		"web"
	],
	"references": [
		"https://learn.microsoft.com/troubleshoot/windows-client/deployment/dynamic-link-library"
	],
	"report_names": [
		"dynamic-link-library"
	],
	"threat_actors": [],
	"ts_created_at": 1775434121,
	"ts_updated_at": 1775826701,
	"ts_creation_date": 0,
	"ts_modification_date": 0,
	"files": {
		"pdf": "https://archive.orkl.eu/b7a2f1027b23ff732d454446893f3fba1f627249.pdf",
		"text": "https://archive.orkl.eu/b7a2f1027b23ff732d454446893f3fba1f627249.txt",
		"img": "https://archive.orkl.eu/b7a2f1027b23ff732d454446893f3fba1f627249.jpg"
	}
}