About .NET compiler target platform (AnyCPU, x86, x64) (rpm)

Today there is a project code to receive customer feedback, all of the requirements of the target platform EXE project all specified as x86, but all DLL projects all target platforms designated as AnyCPU.

 

Here we take a look at what the role of the target platform, each option there is any difference now.

In VisualStudio, there are the following options in the compiler settings:

 

 

x86: the compiled assembly by-compatible 32-bit x86 common language runtime operation.

x64: The grounds of the compiled assembly support 64-bit common language runtime on a computer AMD64 or EM64T instruction set operation.

anycpu :( default value) will be compiled assembly to run on any platform.

Itanium: The assembly is compiled by the 64-bit common language runtime on a computer using Itanium processor to run.

 

Specific behavior is as follows:

On 64-bit Windows operating systems:

X86 with the compiled assembly 32 will execute the CLR running under WOW64.

With x64 compiled assembly 64 will execute on the CLR.

With anycpu compiled executable file will execute on the 64-bit CLR.

With anycpu compiled DLL will be executed on the same process that loads the CLR.

 

On 32-bit Windows operating systems:

With a x86 or anycpu compiled assembly 32 will execute on the CLR.

With x64 can not run the compiled assembly.

 

After figuring out these differences, things go back to the customer, there is no justification for it.

First thing is to know customers want the program to run in the system of WINXP in the above (either 32-bit or 64-bit).

Therefore, it is impossible election x64, Itanium for this particular processor will not go to the election.

 

That have chosen this default Any CPU has no problem with it?

First look at Any CPU and x86 executable (EXE) What is the difference, right at 32 and 64,

Any CPU in 32-bit, EXE 32 will be executed, and at 64, EXE 64 will be executed. The x86, then, has always been carried out in 32.

Customers want to use x86, that is, do not want to execute EXE program with 64-bit mode under 64. The reason is due to my analysis of possible third-party 32-bit DLL system, once executed using the 64-bit EXE, when calling to 32-bit DLL, will not be called.

 

The DLL, customers are looking to adopt Any CPU, the reason my analysis of the actual operation mode to call the DLL is influenced by its EXE, so it is set to Any CPU. If set to x86, although seemingly no problem, but it can not run in the 64-bit CLR, not very good.

Guess you like

Origin www.cnblogs.com/Jeely/p/11322881.html