.NET CSC.EXE output file format

So, I'm interested with .NET runtime architecture and structure. I want to know how it works step by step. I have several books, also looking for in google some answers but now, I want correct answer about some questions.

In books written that, CSC.exe ( compiler ) generates managed module, that contains: 1. PE Header 2. CLR Header 3. Metadata 4. IL Code

and after compilation, tool AL.exe ( assembly linker ) merges that module/s into assembly. I also know that, assembly have two main file extension: DLL or EXE.

But, I'm interested about Managed modules. How it compiles compiler and what the file format have ? does it an .netmodule extension ? OR DLL ?

p.s Sorry for my english.

Upvotes: 2

Views: 794

Answers (1)

mfawzymkh
mfawzymkh

Reputation: 4108

Managed modules are just like .DLL/.EXE in format (they are both PE format, they contain PE header + CLR Header + metadata + code). The difference is that you create a .netmodule if you are doing a multi-module assembly. A multi-module assembly is an assembly that has multiple modules inside it, System.Data.dll is an example of that, since it has both a managed part, and a native C++ part into 1 assembly.

.NetModules are just a convenient way to package multiple modules into 1 assembly. High level compilers (like C#) don't deal with it, that is why you need to use the Assembly Linker tool (AL).

Hope this helps Thanks

Upvotes: 1

Related Questions