dotnetfanatics
All you wanted to know about .Net, .Net Definitions, .Net EBooks, .Net Basics, .Net Essentials, .Net Video Tutorials, .Net Framework, .Net Projects, .Net Compatible Languages, .Net FAQs, .Net Jobs, etc..
Sunday, June 24, 2007
What are the differences between a .NET Assembly, a Windows DLL and a COM Component?
A Windows DLL contains library code to be used by any program running on Windows. A DLL may contain either structured or object oriented libraries. COM (Component Object Model) is the component model based on the object oriented design, which means that the components represented by the COM component exists in the form of classes and objects implementing a standard specification defined by COM. COM components can be used by any program running on Windows Operating System; be it is written with VB, C++, Java or even some .NET compliant language like C# and VB.NET. Dot NET assembly is the component standard specified by the .NET. Hence, dot net assemblies are understandable to only Microsoft.NET and can be used only in .NET managed applications.
What are the differences between a .NET Assembly, a Windows DLL and a COM Component?
A Windows DLL contains library code to be used by any program running on Windows. A DLL may contain either structured or object oriented libraries. COM (Component Object Model) is the component model based on the object oriented design, which means that the components represented by the COM component exists in the form of classes and objects implementing a standard specification defined by COM. COM components can be used by any program running on Windows Operating System; be it is written with VB, C++, Java or even some .NET compliant language like C# and VB.NET. Dot NET assembly is the component standard specified by the .NET. Hence, dot net assemblies are understandable to only Microsoft.NET and can be used only in .NET managed applications.
What is the difference between an executable assembly and a class library?
An executable assembly exists as the .exe file while a class library exists as the .dll file. Executable assembly represent executable applications having some entry (e.g., Main() method in C#). A class library, on the other hand, contains components and libraries to be used inside various applications. A Class library can not be executed and thus it does not have any entry point.
What does one need to build or execute .NET applications?
To execute a standalone .NET application (Windows or Console application), one needs to first compile all its constituent assemblies and modules including the executable assembly. Once, the constituent assemblies are compiled, one needs to make sure that the target system contains the .NET framework. The application can now be executed by running its executable assembly (the .exe file). The executable assembly (.exe) is a Win32 executable that hosts the .Net CLR (Common Language Runtime), which exists as a COM component, in its process space and initializes it. Once the CLR is hosted and initialized, the starting point of the .NET executable assembly is passed to the hosted CLR which starts the execution of the program by translating and executing the parts of the program code.
What does it mean by managed code?
By managed code, it means that the complete life cycle and execution is managed by the .NET Common Language Runtime (CLR). The .NET CLR manages the memory on behalf of the managed code, performs garbage collection on the managed heap, perform assembly validation and assembly (component) resolution on behalf of the program. The CLR also maintains the security constraints applied to the managed code.