编程为64位平台 [英] Programming for the 64 bit platform

查看:105
本文介绍了编程为64位平台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然工作在.NET应用程序(比如说一个Asp.Net之一),是在有工作时在64位平台上,你会做事情的方式任何差异,相比工作在32位平台。

While working on a .Net application (let's say an Asp.Net one), are there any differences in the way you would do things while working on the 64 bit platform, as compared to working on a 32 bit platform.

我会想象很少,因为你正在使用的框架,该框架是照顾大多数事情对你,对吧?

I would imagine very little since you are working on the framework, and the framework is taking care of most things for you, right?

不过,请给你的意见。

感谢。

推荐答案

如果您正在使用P / Invoke,那么你需要确保你有这些DLL的64位版本。这不是一个问题,如果你调用MS提供的DLL文件,如kernel32中,因为他们已经在32位和64位平台(奇怪的,我知道),因此你的64位应用程序将隐式链接到正确的得到了同样的名字版。但是,如果您使用的是第三方的DLL和你的64位应用程序试图连接到一个32位的DLL,你会得到一个运行时异常。

If you're using p/invoke then you need to be sure that you've got 64bit versions of the DLLs available. This isn't an issue if you're calling MS supplied DLLs such as kernel32 as they've got the same name on the 32 and 64 bit platforms (bizarre, I know) and so your 64 bit app will implicitly link to the correct version. However, if you're using 3rd party DLLs and your 64bit app tries to link to a 32bit DLL you'll get a runtime exception.

这也意味着,如果你使用过程中的COM对象,你将有一个问题。一个64位的应用程序可以调用进程外的COM对象,它是32位(反之亦然),因为你正在移动跨越进程边界和COM会照顾编组为你。

This also means that if you're using in-process COM object you'll have a problem. A 64bit app can call an out-of-process COM object that's 32 bit (and vice-versa) as you're moving across a process boundary and COM will take care of the marshalling for you.

除此之外,该框架可以照顾到大多数事情你。你从来没有真正担心指针的大小和CLR类型有明确的尺寸(INT总是32位,长始终是64位)。在纯.NET世界中有很少操心。当你开始,你必须更加小心的沙箱外移动的。

Other than this, the framework takes care of most things for you. You never really have to worry about pointer sizes and the clr types have explicit sizes (int is always 32 bits, long always 64 bits). In a pure .NET world there's very little to worry about. It's when you start moving outside the sandbox that you have to be more careful.

这篇关于编程为64位平台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆