当前位置:网站首页>. net cross platform principle (Part I)
. net cross platform principle (Part I)
2022-04-23 17:04:00 【begeneral】
1、.NET Framework hierarchy
| FCL(Framework Class Library) |
| BCL(Basic Class Library) |
| CLR(Common Language Runtime) |
FCL: This is a for developers API Class library , For example, the framework we often use :Windows Forms、ASP.NET、WPF、WCF etc. . This layer is directly oriented to developers .
BCL: This is the class library at the bottom , Provide code that interacts with the operating system level , Such as :IO、 Thread management
CLR: It provides a managed execution environment for programs , yes .NET Framework Execution engine for .CLR And .NET The relationship of is equal to JVM And Java The relationship between ,CLR It's essentially .NET Virtual machine .
2、CLI
To achieve cross platform , The two types of differences must be addressed : Differences in programming languages and runtime environments . Only programming languages can achieve mutual compatibility , The runtime environment can be unified , Cross platform can be realized .CLI To solve such a problem : Developed by different high-level programming languages .NET Applications can run in different system environments without any change .
CLI Full name :Common Language Infrastructure. among Common Language It refers to the common language , It aims to solve the compatibility problem of various high-level development languages .Infrastructure Refers to the runtime environment , It aims to make up for the differences in execution methods between different platforms .
Programming languages are divided into two types: compiled and interpreted . The former needs to be compiled by the compiler to generate executable code ,CLI It involves compiled languages . To achieve true cross platform , The final problem to be solved is the compatibility and portability of executable code between different platforms . If the executable code generated by different programming languages after compilation is the same , So the difference between programming languages is no longer a problem .
2.1、CIL
according to CLI The provisions of the , Used to describe executable code is a kind of code called CIL(Common Intermediate Language) Language , This is an intermediate language between high-level language and machine language . Although the program source files are written in different programming languages , But we can compile it into CIL Code . In principle , Design a new programming language and add it to .NET in , You only need to use the corresponding compiler to generate a unified CIL The code can be . We can also design a compiler , take java The code is compiled to CIL For the target language . If you say so , In fact, programming languages are just appearances , Object code ( Also known as executable code ) That's the essence. , Because the object code deals directly with the computer . Now draw a picture to illustrate the function of intermediate language .

The differences of programming languages are unified through the compiler , The difference of running environment can be realized through virtual machine (VM) Technology to solve . Virtual machine is CIL Execution container for , Be able to perform CIL The code is dynamically translated into machine instructions that match the current execution environment by means of real-time compilation . Virtual machines mask the differences between different operating systems , So that the target program can run in different underlying execution environments without any modification .
That's the logic ,.NET The application should be able to work in non windows The platform is running , Why in the non windows The platform still doesn't work ? My personal understanding is : Microsoft didn't realize non - windows Virtual machine of platform , That is to say CLR. In other words, Microsoft has only realized windows Platform CLR, therefore .NET Applications can only be windows Platform execution .
版权声明
本文为[begeneral]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230554082479.html
边栏推荐
- vscode如何比较两个文件的异同
- Nodejs installation and environment configuration
- Your brain expands and shrinks over time — these charts show how
- The new MySQL table has a self increasing ID of 20 bits. The reason is
- Handwritten event publish subscribe framework
- Idea of batch manufacturing test data, with source code
- Shell script -- shell programming specification and variables
- How to implement distributed locks with redis?
- Detailed explanation of Niuke - Gloves
- websocket
猜你喜欢

feign报400处理

Sub database and sub table & shardingsphere

Loggie source code analysis source file module backbone analysis

Milvus 2.0 質量保障系統詳解

True math problems in 1959 college entrance examination

Milvus 2.0 détails du système d'assurance de la qualité

1-1 NodeJS

Scope and scope chain in JS

TypeError: set_ figure_ params() got an unexpected keyword argument ‘figsize‘

groutine
随机推荐
线性代数感悟之1
ACL 2022 | DialogVED:用于对话回复生成的预训练隐变量编码-解码模型
DDT + Excel for interface test
Modify the test case name generated by DDT
如何用Redis实现分布式锁?
Feign report 400 processing
Detailed explanation of Milvus 2.0 quality assurance system
Getting started with JDBC
Shortcut keys (multiline)
VLAN高级技术,VLAN聚合,超级Super VLAN ,Sub VLAN
计算饼状图百分比
◰ GL shader handler encapsulation
PyMySQL
Lock lock
Pytorch: the pit between train mode and eval mode
Handwritten event publish subscribe framework
Detailed explanation of Niuke - Gloves
SQL database
Promise (III)
Shell脚本——Shell编程规范及变量