-->

Roll 64-bit and 32-bit versions of an app into the

2019-04-29 22:53发布

问题:

We have an application we're trying to deploy on both 64 bit and 32 bit platforms. Is there a way to put both compiled versions of the code in the same binary, a la Apple and NeXT's fat binaries?

Ideally we could ship one .exe that decides upon execution which version of the code to execute. We're targeting Windows XP and later.

回答1:

One approach is perhaps to supply a bootstrapping application that determines the architecture and chooses the appropriate executable to run. So basically the shortcut or what have you to your application simply starts the bootstrapper which in turn starts the appropriate application. This can be a little more tricky if your application is a Windows service.



回答2:

Process Explorer (was sysinternals, now owned by Microsoft) does this. It is a 32-bit application that detects a 64-bit environment, writes out another binary and deletes it on exit. http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx



回答3:

The simplest approach would be to handle this by the installer - it would have two versions of each binary and copy necessary versions depending on which system bit-ness is at the target machine.