1: first, clarify the concept of CLR: 1: first, clarify the concept of CLR:
CLR (Common Language Runtime): A "RunTime" that can be used by multiple programming languages ";
During runtime, CLR does not care which language is used by developers to change code. It only focuses on whether the language is oriented to CLR (runtime.
2: Core CLR functions include:
Memory Management, assembly loading, security, exception handling, and thread synchronization.
3 ::
650) This. width = 650; "src =" http://image.mamicode.com/info/201407/20181011135912408729.png "/>
No matter which compiler is used, the result is a managed module ), during code hosting, a standard 32-bit/64-bit Microsoft Windows Executable (pe32/pe32 +) file can be transplanted.
The local code compiler generates code for a specific CPU architecture (x86, x64, or IA64. on the contrary, each CLR-oriented compiler generates il (intermediate language) code, which is also called managed code.
In addition to generating Il, each CLR-oriented compiler also generates complete metadata in each managed module. Metadata is a set of data tables. some data tables describe the content defined in the module. The metadata is actually the complete data generated by the compiler.
4: CLR does not actually work with modules. It works with the Assembly.
5: loading public Language Runtime
Each assembly we generate can be either an executable application or a DLL. Ultimately, the CLR manages the execution of the Code in these assembly, so it must be installed on the running machine. net Framework. some Windows versions have been packaged in the built-in system. net Framework. but we need to manually enable it. you can start it in the control panel without further explanation. as a developer, this does not need to be explained.
6: Execute the Assembly Code
To execute a method, you must first convert its Il to a local CPU command, which is the essence of clr jit.
:
650) This. width = 650; "src =" http://image.mamicode.com/info/201407/20181011135912992736.png "/>
Before the main method is executed, the CLR checks all types referenced by the main code, which causes the CLR to allocate an internal data structure for managing access to the referenced types.
A method may cause some performance loss only when it is called for the first time. All future calls to this method will run at full speed in the form of local code. you do not need to re-verify the Il and compile the local code.
The JIT compiler stores local CPU commands in the dynamic memory. Once the application is terminated, the compiled code is also discarded. Therefore, if you run the application again in the future, or start two instances of the application at the same time, the JIT compiler must re-compile the Il command.
6: il verification.
Il is stack-based, so all its commands need to push the operand into an execution stack and pop the result from the stack. because il does not provide instructions for operation registers, it is easy to create new languages and compilers to generate CLR code. the IL command is non-typed. the advantage of Il is robust and secure, because it is compiled into a CPU command, the CPU will verify whether it is safe.
7: framework class library
FCL (framework class library): A group of DLL assembly, which contains many types of definitions, each of which exposes some functions.
Web Service: Web service or WCF technology can easily process messages sent over the Internet.
Web form application: Web form
Windows applications: develop Windows GUI applications.
Rich internet applications: Using Silverlight technology, you can build GUI applications deployed over the Internet. this kind of program can run inside or outside the web browser, and can also run in non-Windows operating systems and mobile devices.
Window Console: provides a simple, convenient way to generate applications and compilers.
Window service: You can use. NET Framework to generate a "service" application.
Database stored procedures: Write stored procedures
Component Library:. Net frameword allows the generation of Independent Assembly (Component). The types contained in the component library can be easily integrated into any library.