惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
J
Java Code Geeks
博客园 - 聂微东
量子位
C
Check Point Blog
T
The Blog of Author Tim Ferriss
T
Tailwind CSS Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
B
Blog
罗磊的独立博客
腾讯CDC
GbyAI
GbyAI
博客园 - 【当耐特】
A
About on SuperTechFans
M
MIT News - Artificial intelligence
U
Unit 42
D
Docker
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
S
SegmentFault 最新的问题
有赞技术团队
有赞技术团队

博客园 - Mr东方欲晓

软件测试经验与教训 SQL优化技术分析-4:其他 SQL优化技术分析-3:SQL语句索引的利用 SQL优化技术分析-2:SQL书写的影响 SQL优化技术分析-1:操作符优化 如何做好一个Sprint Demo 每日Scrum站会实践推荐 Linux常见查看硬件信息指令 MS SQLServer 2008数据库处于SUSPECT情况下的处理 ALM损坏后的恢复步骤 WEB页面中常见的四种控件的必须的测试 敏捷测试模式之Scrum及其实践 CentOS如何查看硬盘品牌型号等具体信息 64-bit Applications WoW64 在未安装 Outlook 的情况下创建 MAPI 配置文件 电脑的32位与64位是指的什么 How do exes/dlls generated with the /platform:x switch interact? C# Compiler Options
Any CPU vs x86 vs x64 Solution Platforms
Mr东方欲晓 · 2011-02-24 · via 博客园 - Mr东方欲晓

Hi,

I have my projects in VS 2008 SP1 and is using .NET 3.5 SP1. Till now we are developing application in Any CPU platform setting for all the projects and supported only 32-bit platforms. Now we are going to support 64-bit OS platforms as well.

Q-1. What difference it makes by building solution for Any CPU, x86 and x64 platform?

Q-2. Will it make any difference if I build my application using Any CPU platform setting and run on x64 platform?

Q-3. What are the advantages of creating different builds for x86 and x64? Any performance gain? anything considerable change?

Q-4. I have my VC++ dll library which is imported in one of my C# project as well. What changes are required in that VC++ dll to make it running on both x86 and x64?

Appreciate your inputs.


For Q1-Q3:

AnyCPU will compile your assembly to run on any platform. DLLs and EXEs compiled with AnyCPU option will behave with sutle difference. On a 64-bit Windows operating system, EXEs compiled with this option will execute on the 64 bit CLR, while DLLs compiled with this option will execute on the same CLR as the process into which it is being loaded. So, if a 32bit EXE load a DLL that is compiled with this option, the process is 32bit so the DLL will run on the 32bit CLR.

x86 option compiles your assembly to be run by the 32-bit, x86-compatible common language runtime. On 32bit platform, the EXEs will run as 32bit process. On 64bit platform, the EXEs will run under WOW64 mode.

x64 option compiles your assembly to be run by the 64-bit common language runtime on a computer that supports the AMD64 or EM64T instruction set.

Also please take a look at: How to: Optimize an Application for a Specific CPU Type

For Q4:

Please take a look at : How do exes/dlls generated with the /platform:x switch interact?