Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 969
lfaraone Avatar asked Apr 29 '09 12:04

lfaraone


2 Answers

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

like image 66
Andrew Avatar answered Oct 21 '22 04:10

Andrew


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.

like image 42
BobbyShaftoe Avatar answered Oct 21 '22 04:10

BobbyShaftoe