17

Building a Windows 8 app, developers can choose HTML/JavaScript, XAML/.Net (C#/VB), and XAML/C++. I want to write my app in XAML/C++.

Building applications in the first two choices almost guarantees that your application will execute on both Intel and ARM architectures.

But I have heard that if I do certain things in my C++ app, I can cause the application NOT to execute on the ARM architecture. But I don't know the details.

Does anyone know what C++ Windows 8 apps should avoid so that they can run on ARM okay? Are these architecture decision or just differences in technique?

4

4 回答 4

3

为了在每个架构上运行,显然您首先需要为每个架构进行编译。如果您编写标准 C++(并且如果您不依赖未定义的行为和/或特定于平台的行为),那么在架构之间移植时通常会引起麻烦的事情是:

(此列表是一个示例)

  • int、long、long long(和其他)的大小可能因平台而异
  • char 的签名
  • 如何填充结构
  • 浮点数的二进制布局
  • 字节序
  • 等等。

如果你避免疯狂的指针算术和强制转换,通常你是安全的。

于 2012-10-22T19:51:59.283 回答
1

我不知道有什么会使您的代码根本无法在 ARM 下执行或编译(内联汇编除外)。

但是,您可以做一些事情,这会使 ARM 给出错误的答案。

ARM 处理器是“弱排序”的,这篇最近的文章为您提供了低调

http://preshing.com/20121019/this-is-why-they-call-it-a-weakly-ordered-cpu

但总而言之,ARM 处理器可能会重新排序内存访问,如果您不小心,这可能会给您在多线程应用程序中的 x86 和 ARM 架构之间带来不同的结果。

于 2012-10-22T19:48:33.363 回答
0

MFC 应用程序不能在基于 ARM 的 Windows 8 系统上运行。

您可以使用 C++ 构建 Metro 风格的应用程序,您只需遵循 Metro“风格”指南。

如果您希望您的所有程序都支持基于 ARM 的 Windows 8 系统以及基于 x86 的系统,请将您的程序更改为使用 HTML/CSS 或 XAML 和 WinRT API 而不是 MFC 和 Win32 API。

于 2012-10-23T05:47:04.610 回答
0

ARM 仅支持 Windows 应用商店应用。

系统要求

支持的体系结构:适用于 Windows 8 的 Windows SDK 支持为以下体系结构构建应用程序: x86 x64 ARM(Windows 应用商店应用程序) 注意:适用于 Windows 8 的 Windows SDK 不能直接安装在 ARM 体系结构上。您可以在 x86 或 x64 平台上安装 Windows SDK,以构建面向 ARM 架构的应用程序。

这是您可以参考的文章的链接。

于 2012-10-22T19:51:44.160 回答