简体   繁体   中英

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). One is 32 bit and the other is 64 bit. I am able to compile them into 2 separate exe files that work independently. 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. Can I do that using Visual Studio or other means?

The Windows PE EXE format does not support multiple CPU architectures in a single binary.

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. 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.

Note: Windows Server Core can be installed without Wow64 support and you must also distribute the 64-bit binary if you support those systems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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