. NET Program compilation principles

Source: Internet
Author: User

Lead:

The CPU only recognizes binary code. How does the C # source code become a binary code that can be recognized by the CPU?

The procedure is as follows:

1. C # source code

2. Use the Command Prompt window provided by VS to convert the C # source code into an assembly (EXE or DLL file). The Assembly is mainly composed of MSIL (Microsoft intermediate language, by decompiling the assembly, you can see the Microsoft intermediate language in it.

3. After running the EXE file ,. net framework also starts to run. The (instant compiler) in it (when the common language is running) converts the intermediate language into the CPU instruction of the local platform and sends the instruction to the CPU for execution.

 

Question:

1. Why is the Assembly not directly converted into binary code? Isn't it faster?

The commands for the same action are different for CPUs of different brands and models. C and C ++ are directly converted to binary, it only compiles the language code into the intersection of different CPUs. NET Program compilation, first judge the CPU asterisks of the Local Machine, JIT converts the intermediate language into a CPU command, can make full use of each function of the current CPU, so, not C, C ++ is more efficient than C #. C # is sometimes more efficient than C and C ++.

2. Can. NET be cross-language?

Yes. VB. NET has a VB compiler to convert the VB language into a Microsoft intermediate language. The rest do not need to be done. The rest do the same.

3. Is. NET cross-platform?

Yes. Use mono.

 

Figure:

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.