Windows 开发:x86 到 x64 的过渡 [英] Windows development: x86 to x64 transition

查看:42
本文介绍了Windows 开发:x86 到 x64 的过渡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何指导方针如何以尽可能少的痛苦过渡到 x64?

Are there any guidelines how to transit to x64 with as little pain as possible?

假设,我有一个用 C++ 编写的 Windows 本机 x86 可执行文件.EXE 本身运行良好,但也有 DLL 由前 EXE 和外部 x64 进程托管.像这样的设置,我需要重写哪些部分?

Suppose, I have a windows native x86 executable written in C++. The EXE works fine by itself, but there is also DLL that is hosted by both, the former EXE and an outside x64 process. With setup like this, what parts would I need to rewrite?

我希望得到一个更笼统的答案,或者提供一些理论背景的参考链接.谢谢

I would appreciate a more general answer or maybe a link to a reference where some theoretical background is given. Thanks

推荐答案

总的来说,我推荐的方法是进行单元测试.构建您的测试,以便它们都通过 32 位实现,然后开始在 64 位上构建和测试.值得特别注意代码中执行以下任何操作的任何部分:

In general the approach I recommend is to Unit Test the hell out of it. Build up your tests so that they're all passing on the 32-bit implementation and then start building and testing on 64-bit. It's worth devoting particular attention to any parts of your code where you do any of the following:

  • 通过网络流式传输数据(特别是对于 size_t 这样的类型,它们现在将具有不同的大小.通过此代码并更改诸如 size_t 之类的内容long 到显式 32 或 64 位 typedef)
  • 加载/保存二进制数据到文件(同上:size_t/long)
  • 使用硬编码值(例如 0xFFFFFFFF)进行位处理
  • Stream data across the network (especially for types such as size_t which will now be a different size. Go through this code and change things like size_t and long to explicit 32 or 64-bit typedefs)
  • Load/save binary data to file (ditto re: size_t/long)
  • Do bit-twiddling with hardcoded values such as 0xFFFFFFFF

除了测试尽可能多的代码路径之外,真的没有捷径可走.这项工作的难易程度取决于编写代码的可移植性.你可能很幸运...

There really are no shortcuts except to test as many code paths as you can. How easy the job will be will depend on how portably the code was written. You might be lucky...

这篇关于Windows 开发:x86 到 x64 的过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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