如何在32位计算机上用VS 2005交叉编译64位DLL?

发布于 2024-07-25 23:44:27 字数 318 浏览 4 评论 0原文

我使用 Visual Studio 2005 用 C 语言编写了一个简单的 DLL,它使用 Windows API 发送 UDP 数据报,并连接到第三方程序。 在 64 位机器上,它根本不起作用,因为在这种情况下第三方代码是针对 64 位编译的。 因此,我需要提供同一 DLL 的两个版本 - 一种用于 32 位,一种用于 64 位。

然而,我没有设法让 Visual Studio(在 32 位机器上运行)吐出一个与 32 位版本不同的 DLL - 似乎项目属性中的“机器”设置被简单地忽略了。 一位同事告诉我 VS 2008 在这种情况下根本拒绝交叉编译。 难道这真的根本不可能吗?

Using Visual Studio 2005, I wrote a simple DLL in C that uses the Windows API to send UDP datagrams and that is hooked into a third-party program. On a 64 bit machine, it does not work at all, as the third-party code was compiled for 64 bit in this case. So I need to ship two versions of the same DLL - one for 32 bit, one for 64 bit.

However, I did not manage to get Visual Studio (running on a 32 bit machine) to spit out a DLL that is not identical to the 32 bit version - it seems the 'machine' setting in the project properties is simply ignored. A colleague told me VS 2008 simply refuses to cross-compile in this scenario. Is this really not possible at all?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放血 2024-08-01 23:44:27

右键单击解决方案资源管理器中的项目,然后转到“属性”/“配置管理器”/“活动解决方案平台”:<新建...> / x64 / 确定/关闭。 然后在Platform中选择x64,OK,就可以了。

Right click the project in the Solution Explorer then go Properties / Configuration Manager / Active Solution platform: <New...> / x64 / OK / Close. Then select x64 in Platform, OK, and you're good to go.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文