• Home
  • Forum
  • Terms and Privacy
17ebook! free ebooks! free download!
Complete online surveys and earn cash from GlobalTestMarket


Search here...
     

CLR via C # 3 reading notes (1): CLR execution model in Chapter 1 – 1.1 Compile the source code for the managed module

Posted by admin 17 February, 2011

CLR via C # 3 reading notes (1): CLR execution model in Chapter 1   1.1 Compile the source code for the managed module

CLR the name suggests, refers to a variety of different programming languages can be used runtime. CLR can be used for all the core features of the programming language for it. For example, run-time errors using exceptions to report, all the language-oriented run-time exception to get through the error report. Another example, also allows the creation of threads running, all the language-oriented run-time thread can also be created.
At runtime, CLR language used on the developer to complete the source code for nothing. We can choose any language to write code, as long as the compiler can compile code for the CLR.
How to select language? Authors believe that the compiler is a grammar checker, and “correct code” of the analyzer, which checks source code, make sure you write a meaningful and describe your intended output of the code. Different languages have different syntax. For different purposes, you can choose a different language. Can significantly reduce the amount of code.
Microsoft has created a language for the CLR compiler: C + + / CLI, C #, Visual Basic, F #, IronPython, IronRuby, and an intermediate language assembler (Intermediate Language Assembler).
Managed Module
The following diagram shows the process of compiling the source code files. As shown, we can use any CLR language to write the source code file, then the compiler will check the appropriate syntax, and analyze the source code. Regardless of the compiler, the final results are managed module (Managed Module). CLR managed module is a need to be able to perform the standard 32-bit Microsoft Windows portable executable (PE32) file, or standard 64-bit Windows Portable Executable (PE32 +) files.

The composition of managed module
PE32 or PE32 + header: standard PE file header, similar to the Common Object File Format head. If the first use of PE32 format, the file can be run on 32-bit or 64-bit Windows which. If the header using the PE32 + format, the file must run them on 64-bit Windows. The head is also the type of the file named: GUI, CUI, or DLL, and also to specify the file contains a time stamp when created. IL code for the module that contains only, PE32 (+) in the amount of information will be ignored. Contains the code for the local CPU module, the first code also includes information on the local CPU.
CLR header: identify the managed module that contains some information (CLR or some tools that can be resolved). Including managed module required CLR version number, number of tags managed module entry point method (main method) MethodDef metadata tagging, and metadata related to managed module (metadata), resources (resources), strong named (strong name) , mark (flags), and other information is not meaningful location and size.
Metadata: Each module contains a number of managed meta data tables. Metadata table is divided into two types: one defined in the code used to describe the types and members. A reference code used to describe the types and members.
IL code: the compiler source code generated code. At runtime, CLR will compile the IL to the local CPU instruction.
Most of the early compiler-generated code is for a specific CPU architecture. All CLR-compliant compiler is generated IL code. IL code, also known as managed code (managed code), because the CLR to manage their implementation.
Metadata
In addition to generating IL, each compiler for CLR requires that all managed module also generates a complete metadata. In short, metadata is a set of data tables, the data table has a number defined by the description of the content managed module (such as the definition of the types and their members), in addition to some descriptive content referenced managed module (such as reference types and their members.) Metadata is some of the early technologies, such as COM type libraries and IDL (Interface Definition Language) files superset. Should be noted that, CLR metadata than they are to complete. And IDL and type libraries, and the difference is, metadata is always the file that contains code associated IL. Metadata is always a matter of fact, and the code (IL code?) With embedded in the same EXE / DLL file, the two are inseparable. Because the compiler while generating metadata and IL code, and bind them to build a managed module, hence the description of metadata and IL code always maintained between the synchronization.
The use of metadata
Compile-time metadata no longer need to make the local C / C + + header files and library files, it is because to achieve the type containing the members of the IL code and files, have been cited include the types and members of the information. Compiler can be read directly from the managed module metadata.
Visual Studio uses the metadata to help us write code. IntelliSense feature by parsing the meta data to tell us the type provided by the methods, properties, events, and fields, and the method parameters.
CLR code verification process to ensure that the code uses the metadata to perform only “type-safe” operation.
Metadata field of an object can be serialized to the memory block, passed to another computer, and then deserialize, and the remote computer to re-create the object state.
GC tracking objects using metadata life cycle. For any object, GC can be obtained from the metadata of its type, and which fields refer to other objects.
For more detailed metadata, content, in Chapter 2.
C #, VB.NET, F # and the compiler always generated IL contains managed code (IL), and managed data (GC data type) modules. These include end-user to perform managed code and managed data module, you must install the CLR (currently used as. NET Framework as part of release). This MFC or VB6 applications to run must be installed and the VB DLLs MFC library is the same reason.
By default, C + + compiler is included unmanaged (native) code of the EXE / DLL module, in the run-time operation of a non-managed data (local memory). Implementation of these modules do not need to CLR. However, if you specify / CLR command-line options, C + + compiler will generate the module contains managed code, and the execution environment must also install the CLR. C + + is the only allowed developers to write managed and unmanaged code and generate the same module in the compiler. This allows developers to use managed code in non-managed code.

Categories : book review Tags :

Comments

No comments yet.


Sorry, the comment form is closed at this time.

Subscribe via Email


Windows Touch Technics and Technology tablet Solution Manual Smart Security/Hacking Science Related Science/Engineering samsung Review Programming Phones phone Nokia Newspapers netbooks Netbook Mobile Medical/Medicine Laptops Laptop IT Certification Iphone Hobbies Health Graphics and Design Google Game For Women For Men features Ericsson Encyclopedias Economics and Finances Economics/Business deals DB Consumer Electronics Computer Related Computer Comics Apple android about
  • Categories

    • book review
    • Ebook Download
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
  • Archives

    • May 2013
    • April 2013
    • March 2013
    • February 2013
    • January 2013
    • December 2012
    • November 2012
    • October 2012
    • September 2012
    • August 2012
    • July 2012
    • June 2012
    • May 2012
    • April 2012
    • March 2012
    • February 2012
    • January 2012
    • December 2011
    • November 2011
    • October 2011
    • September 2011
    • August 2011
    • July 2011
    • June 2011
    • May 2011
    • April 2011
    • March 2011
    • February 2011
    • January 2011
    • December 2010
    • November 2010
    • October 2010
    • September 2010
    • August 2010
    • July 2010
    • June 2010
    • May 2010
    • April 2010
    • March 2010
  • Recent posts

    • Windows Phone (mango) creating splashes in Global Market of Smartphones
    • Main features of the PDA mobile phones
    • Advantages Of Windows 7 Ultimate And Laptops
    • Nokia Lumia 800 Deals: Mid-Range Segment Just Get Better
    • How come Windows Replacement Can not be Delayed
    • Google Mail For Mobile Phones
    • Jailbreaking and unlocking yours i-phones
    • HTC Touch2 – A World-beater
    • The San Diego Real Estate Bubble
    • HTC Desire – Awake to Make the World Run Behind you

Copyright © 2013 17ebook! free ebooks! free download! All right reserved

  • Home
  • Forum
  • Terms and Privacy