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

喜你入骨 提交于 2019-12-07 04:13:51

问题


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.



来源:https://stackoverflow.com/questions/802192/roll-64-bit-and-32-bit-versions-of-an-app-into-the-same-binary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!