简体   繁体   English

将32位和64位应用程序(使用相同的代码)编译到一个exe中

[英]Compile 32 bit and 64 bit application (with same code) into one exe

I have 2 applications that uses global hooks, and its built for Windows 10 (64 bit). 我有2个使用全局钩子的应用程序,它是为Windows 10(64位)构建的。 One is 32 bit and the other is 64 bit. 一个是32位,另一个是64位。 I am able to compile them into 2 separate exe files that work independently. 我能够将它们编译成2个独立的独立exe文件。 But since they have the same code, I wish to compile them into one exe file that will cater to both it's 32 bit and 64 bit responsibilities. 但由于它们具有相同的代码,我希望将它们编译成一个exe文件,以满足它的32位和64位职责。 Can I do that using Visual Studio or other means? 我可以使用Visual Studio或其他方法吗?

The Windows PE EXE format does not support multiple CPU architectures in a single binary. Windows PE EXE格式不支持单个二进制文件中的多个CPU体系结构。

The SysInternals tools embed the 64-bit .exe as a resource in the 32-bit executable and extracts and runs that if IsWow64Process is true. SysInternals工具将64位.exe作为资源嵌入到32位可执行文件中,并在IsWow64Process为真时提取并运行该文件。 If you choose this technique you must also take into account that the recent ARM64 machines are Wow64 but only emulate 32-bit x86 applications. 如果选择此技术,还必须考虑最近的ARM64计算机是Wow64但仅模拟32位x86应用程序。

Note: Windows Server Core can be installed without Wow64 support and you must also distribute the 64-bit binary if you support those systems. 注意:可以在没有Wow64支持的情况下安装Windows Server Core,如果支持这些系统,还必须分发64位二进制文​​件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM