问题描述
我对 Visual Studio 2008 中的 .NET 平台构建选项有些困惑.
I have some confusion related to the .NET platform build options in Visual Studio 2008.
Any CPU"编译目标是什么,它生成什么样的文件?我检查了这个任何 CPU"构建的输出可执行文件,发现它们是 x86 可执行文件(谁不会看到它的到来!).那么,将可执行文件定位到 x86 与任何 CPU"之间有什么区别吗?
What is the "Any CPU" compilation target, and what sort of files does it generate? I examined the output executable of this "Any CPU" build and found that they are the x86 executables (who would not see that coming!). So, is there any difference between targeting executable to x86 vs. "Any CPU"?
我注意到的另一件事是托管 C++ 项目没有这个平台作为选项.这是为什么?这是否意味着我怀疑Any CPU"可执行文件是纯 32 位可执行文件是正确的?
Another thing that I noticed, is that managed C++ projects do not have this platform as an option. Why is that? Does that mean that my suspicion about "Any CPU" executables being plain 32-bit ones is right?
推荐答案
AnyCPU 程序集在加载到 64 位进程时会 JIT 到 64 位代码,而在加载到 32 位进程时会 JIT 到 32 位-位过程.
An AnyCPU assembly will JIT to 64-bit code when loaded into a 64-bit process and 32 bit when loaded into a 32-bit process.
通过限制 CPU,您会说:程序集正在使用某些东西(可能是某些东西)非托管)需要 32 位或 64 位.
By limiting the CPU you would be saying: There is something being used by the assembly (something likelyunmanaged) that requires 32 bits or 64 bits.
这篇关于Visual Studio“任何 CPU"有什么作用?目标是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!