如何在 32 位计算机上与 VS 2005 交叉编译 64 位 DLL? [英] How to cross-compile 64bit DLL with VS 2005 on 32bit computer?

查看:33
本文介绍了如何在 32 位计算机上与 VS 2005 交叉编译 64 位 DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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?

推荐答案

在解决方案资源管理器中右键单击项目,然后转到属性/配置管理器/活动解决方案平台:<New...>/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.

这篇关于如何在 32 位计算机上与 VS 2005 交叉编译 64 位 DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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