Sunday, 4 January 2015

.Net Framework: All about CLR - Part I - Chapter 1 - Section 2

Dear Readers,

We know that this complete collection of posts called All about CLR is a conversation between Me and Yendhr9014. Hope we know that the last two posts covers the first section of All about CLR Chapter 1 of Part I.

Section 1 - Compiling Source code into Managed Module
Post #1
Post #2

We are continuing to the next section as follows. Lets proceed with the conversation.

Section 2 - "Combining Managed Module into Assemblies". 

Creation of assemblies and modules in C#
Creation of assemblies and modules in C# (Photo credit: Wikipedia)
Me: Yendhr9014, That was cool to understand more about the Managed Module, Can I move further by asking more questions? Since our state government has capable of terminating the electrical supply frequently, I hope you have proper backup power source.

Yendhr9014: Yes Master!, I have an UPS backup which is waiting for the power cut to activate. No problem that you can have more questions and am at the fullest to answer them properly.

Me: Cool, So my Hello World program upon compiling will be changed to managed modules with IL code in it, These modules are the one that CLR are looking for right?

Yendhr9014: Not exactly sir, Its actually Assemblies that CLR is looking for not the direct managed code, my master!

Me: You have confused me Yendhr9014, What is meant by an Assembly?

Yendhr9014: An Assembly is a logical grouping of one or more managed modules with/ without resource files. So our simple hello world code will be transformed to single managed module based that the program contains single line, however when we write more number of lines of codes, the compiler first compiles it to form one or more managed module in a directory along with associated resource files, this grouped managed modules and with or withour resource files is known as assembly.

Me: Resource files?

Yendhr9014: External files like images, htmls or any other files associated which our code uses are called resource files.

Me: In simple words, Assembly is a collection of IL and metadata of managed modules along with the resource files.

Yendhr9014: Yes, You had it right master.

Me: So each managed module will have their own metadata and Assembly will have multiple managed modules likewise Assembly will have multiple metadata. How comes a single assembly can handle multiple metadata?

Yendhr9014: That was the most smart question master, to reduce the confusion microsoft introduced the concept called Manifest which is a metadata of Assembly or simply metadata of multiple metadata.

Me: Tell me Yendhr9014, is it possible to have a control on managed modules or in simple words may i put my rarely used to code in separate file of an assembly? So that user can download it later based upon current demand?

Yendhr9014: You can do it, my Master.

Me: Okay, if in special case, if my compiler emits multiple managed module contained in a single assembly and I want to have managed modules grouped together into a single file(not into the single directory), How can I do it?

Yendhr9014: We can make use of an executable application called AL.exe named for Assembly linker. Microsoft ships this Exe along with framework.

Me: Assembly concept is cool.

Yendhr9014: By the way master, the assembly is created in a such a way that it is self describing, which is the CLR can determine assemblies' immediate dependencies in order for assembly to execute.

Section 2 - "Combining Managed Module into Assemblies" Ends here.

Jan 4, 2014

No comments:

Related Posts