i have 2 exe's one is managed and other is unmanaged.
while executing how os identifies this is a managed code and we need to invoke the clr
i have 2 exe's one is managed and other is unmanaged.
while executing how os identifies this is a managed code and we need to invoke the clr
How OS Invokes CLR
CBurgett
Sorry, which is the answer :-)
Let us know!
Bye,
Giulio
Adam Baruh
Actually truth be told, the OS does not load the CLR. The CLR hosts do. There are three that ship by default(discounting SQL server) and they are Windows Shell, Ie, asp.net.
All that the OS knows about the managed exe is that it is a PE file. Based on some flags in the PE file, the OS then loads MSCOREE.dll and then executes a function, _CorEXEMain or _CORDllMain in MSCOREE.dll that is responsible for loading and initializing the CLR.
Sarath C
Shawn,
I guess both the newer and the older versions of Operating Systems calls CorExeMain of mscoree.dll to host the CLR into a process. I gues the newer versions do this direclty and the older ones executes a stub routine to do this.
Can you please clarify this...
Thanks,
Suresh.
Helmut Leitner
Hi,
Managed executables will have something called CLR header which tells the OS that the exe is not the ordinary Win32 PE file and it needs CLR for execution.
Thanks,
Suresh.
ahmed_black_horse
The combination of these two answers are correct
. Older versions of Windows shipped before the CLR, and therefore didn't know anything about managed code. On those operating systems, the EXE's entry point delegates to CorExeMain in mscoree.dll (or CorDllMain for a DLL), which does the work of loading the runtime, getting the entry point JITed, and transfering control back to it.
On newer versions of the OS, Windows does know about managed code, so it does look for the CLR header and transfer to mscoree.dll to do the work of getting the code up and running.
-Shawn
jbmac
This is awesome stuff!
wabs27
i got the answer.
thanks