rohit singh
rohit singh

Reputation: 1289

what is a managed module? what is the difference between managed module/PE32 and assembly?

I'm trying to find the difference between Assembly and managed module.

Once we build our application the assembly is loaded in bin->Debug->.

For example my assembly name is Bawolf.Practise.exe. It can be viewed through ildasm.exe Bawolf.Practise.exe.

Managed Module - A managed module is a standard 32-bit Windows portable executable (PE32) file or a standard 64-bit Windows portable executable (PE32+) file that requires the CLR to execute.

enter image description here

My question is assembly is also an executable file and i can find it inside the folder, so where is managed module located and how can i view it? What's the difference between managed module and assembly? And what exactly is meant by a module? Kindly explain in a simple way!

Upvotes: 1

Views: 1130

Answers (2)

Hans Passant
Hans Passant

Reputation: 941465

If you ever worked with a C or C++ compiler then the concept is simple to understand. Their build model is the compiler translating one source code file at a time into an object module. A .obj file on Windows, .o on Unix. A linker then combines the object modules into an executable program.

There was a hard necessity for such a build model in the previous century, computers did not have enough memory to allow building an executable in a single step without the intermediate object modules. On a 16-bit machine, like a PDP-11, the linking step was the painfully slow one. It is still a stretch today if you build, say, a browser like Chrome.

.NET has this build model as well. The object module is a .netmodule, created with the /target:module option for the C# compiler. The linker is al.exe

While this might have been used in the very early days of .NET when they were bootstrapping, it is very rarely used today. Computers have plenty of memory and .NET makes it very simple to logically break up your program into separate assemblies. Creating one that's more than 10 megabytes is pretty unusual, this does not strain a modern machine by a long shot. The kind of projects you can create with the IDE don't support it either so it is largely academic.

Upvotes: 2

simon at rcl
simon at rcl

Reputation: 7344

An exe file contains executable code (i.e. compiled/linked so the OS can run it). When an exe is started, the OS goes to a standard part of it, and starts running the code found there (this is known as the entry point).

In a .NET exe, the entry point contains code which calls the .NET runtime (a dll) and tells the runtime where in the .exe the IL for that exe starts. The runtime starts itself and then starts compiling and running the IL code in the .NET exe.

So the .NET exe contains some boiler-plate code (generated by the compiler) at the entry point - and that's just about all the executable code in it. It also contains the .NET code compiled to IL which is not executable until the runtime has compiled it.

A Module in the sense you are using it (it is used different ways in different places and contexts) is a transient thing that only the .NET compiler worries about. It is a block of .NET code which the compiler treats as a unit when compiling a set of source files into a single exe or dll.

A .NET assembly can be either an exe or a dll file.

Upvotes: 0

Related Questions