CLR via C # 3 reading notes (3): CLR execution model in Chapter 1 – load CLR
|
Get your FREE Diabetes Recipes eBook! |
Assembly or an executable application, or a contains a type of DLL, these types of applications for the executable. CLR managed assembly that contains the code in the execution. This means that the host must be installed. NET Framework.
If the machine is installed. NET Framework, in the% SystemRoot% \ System32 directory will contain MSCorEE.dll file. A machine can install multiple. NET Framework version. Use the following this path, you can see in the registry which version is installed.
HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ NET Framework Setup \ NDP
. NET Framework SDK comes with command-line tool CLRVer.exe can display all the CLR versions installed.
If the assembly contains only type-safe managed code, you write the code in 32-bit and 64-bit Windows versions and does not require changing any code. In fact the compiler to generate the EXE / DLL file can be run on 32-bit Windows, you can run 64-bit x64 and IA64 versions such as Windows. Means that a file can be installed in any appropriate. NET Framework version of the machines.
In rare cases, developers will write in the special version of Windows, run the code. Usually need to use unsafe code or a particular CPU architecture for non-managed code to interoperate time. C # provides a compiler / platform command-line options. This option allows you to specify the resulting assembly is running on x86 machines (32-bit Windows) or a x64 machine (64-bit Windows), or Intel Itanium machines (64-bit Windows). If you do not specify platform, the default is anycpu. Visual Studio users can set the project properties page for the platform project.
C # compiler options generated under the PE32 or PE32 + header that contains the assembly, but also including the required CPU architecture (or agnostic). Microsoft released two SDK command line tools, DumpBin.exe and CorFlags.exe, you can check the compiler generates a managed module’s header.
When running an executable file, Windows checks the first EXE file to decide if the application is necessary 32-bit or 64-bit address space. PE32 header file can be run in 32-bit or 64-bit address space, PE32 + header file can only run 64-bit address space. Windows also checks embedded in the head of the CPU architecture, to ensure that their computer to match the CPU type. Currently, the 64-bit versions of Windows provided a technology that allows running 32-bit Windows applications. The technology is called WoW64 (Windows on Windows64). It can also imitate the x86 instruction set, allowing native code on x86 32-bit applications running on Itanium machines, despite the significant loss of performance.
The following table shows the two elements. 1) When you specify a different / platform command-line option will be what type of managed module. 2) how the application of different versions of Windows.
EXE file in Windows Check the head and decide to create 32-bit, 64 bit or after WoW64 bit process, Windows will be x86, x64 or IA64 versions of MSCorEE.dll loaded into the process address space. In the x86 versions of Windows,, x86 version of MSCorEE.dll located in C: \ Windows \ System32 directory. x64 or IA64 versions of Windows,, x86 version of MSCorEE.dll located in C: \ Windows \ SysWow64 directory, located in the 64-bit version of C: \ Windows \ System32 directory (for backward compatibility.) Then, the process’s main thread calls the method defined in MSCorEE.dll. The method initialize CLR, load the EXE assembly, and call the entry point method (Main). Such hosted applications to build and run. (Can be used in the code or Is64BitProcess Environment of Is64BitOperatingSystem property to check whether the run in 64-bit versions of Windows, or run in 64-bit address space.)
If an unmanaged application calls LoadLibrary to load a managed assembly, Windows will load and initialize the CLR (if you have not loaded it). Of course, in this scenario, the process has been created and run, which would limit the availability of the assembly. For example, using the / platform: x86 compiled managed assembly process can not be loaded 64-bit, on the contrary, an option to use the same executable file will be compiled in the form of WoW64 64-bit version of Windows is loaded.
Sorry, the comment form is closed at this time.


Comments
No comments yet.