Assembly vs DLL
A library is a collection of resources that can be used to develop applications. A library is usually made up of subroutines, functions, classes, values and types. During the linking process (usually done by a linker), libraries and executables make reference to each other. DLL files are the library files that are linked dynamically. DLL was developed by Microsoft. But due to some problems present with DLL files, Microsoft came up with Assembly file format (with the .NET framework). Assembly files are very similar to DLLs physically, but they have many internal differences.
What is DLL?
Dynamic Link Library (more commonly known as DLL) is a shared library implementation developed by Microsoft. It uses the .dll, .ocx or .drv extensions and they are used in Microsoft Windows and OS/2 operating systems. .dll is used by the regular DLL files. And .ocx extension is used by the libraries that contain ActiveX controls and .drv extension is used by legacy system driver files. The DLL file format is same as the Windows EXE files (Portable Executable files on 32-bit/64-bit Windows, and New Executable on 16bit Windows). Therefore, any combination of code, data and resources can be contained in DLL files (just like in EXE files). As a mater of fact, data files with the DLL file format are called resource DLLs. Icon libraries (with .icl extension) and font files (with .fon and .fot extensions) are examples of resource DLLs.
称为部分的组件构成了DLL,每个部分都有其自己的属性,例如读/可执行/可执行/非可执行文件。代码部分是可执行的,而数据部分是不可执行的。代码部分共享,数据部分是私人的。这意味着使用DLL的所有进程都将使用代码的相同副本,而每个过程将具有自己的数据副本。Windows的主要动态库是kernel32.dll,它包含Windows上的基本函数(文件和内存相关功能)。COM(组件对象模型)是DLL到OOP(面向对象的编程)的扩展。传统的DLL比COM文件更易于使用。
What is an Assembly?
Assembly files were introduced by Microsoft in order to solve several problems present with DLL files. Assembly files were introduced with the Microsoft .NET framework. An executable logical unit of functionality is called an Assembly. Assemblies are executable under .NET CLR (Common Language Runtime). Physically, assemblies exist as EXE or DLL files. But, they are very different to Microsoft Win32 DLLs, internally. An assembly file is made up of a manifest, metadata, MISL (Microsoft Intermediate Language code) and other resources. An assembly is self-describing. The manifest contains the information such as name, version, culture, strong name, files list, types and dependencies. MISL code is executed through CLR (it cannot be directly executed).
What is the Difference between Assembly and DLL?
DLL is a dynamically linked library. Although, assemblies are physically equal to DLLs, they are very different internally. It is not possible to maintain consistency between a set of DLLs, but the CLR can maintain consistency between a set of assemblies, because assemblies are self-describing (they contain the list of dependencies internally). Unlike for DLLs, versioning information is enforced for assemblies (by the CLR). Side-by-side deployment (different applications using different versions) is possible with assemblies.
发表评论