Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am developing a 64 bit application. Is it possible to run the 64 bit application on a 32 bit OS?

Tags:

c

32bit-64bit

I am developing a 64 bit application. Is it possible to run the 64 bit application on a 32 bit OS?

Please note that the question is generic and not specific to Windows OS. Infact the application in itself is portable across OS.

like image 998
Jay Avatar asked Feb 25 '10 09:02

Jay


1 Answers

(We'll assuming your talking about AMD64 (== EM64T == x86_64) and x86 for 64-bit and 32-bit respectively)

You can run AMD64 code on x86 processors only by emulation (e.g. qemu), or some kinds of virtualisation (I believe VMWare might support 64bit guest OS on 32bit host OS on 64 bit capable CPU). However this means running a 64-bit OS as a guest on emulation or virtualisation I believe.

As you're developing the application, it shouldn't be too hard to develop both 32-bit and 64-bit builds of your code.

For Mac you can ship a single binary that has both types of code in it, or Mac OSX can run your 64-bit binary on a 32-bit kernel (only on a x86_64 capable processor though). For Windows and Linux, you'll either have to ship separate installers, or ship some smart installer, that selects the correct binaries at install time. For Linux there is a project for add the ability to run AMD64 code on x86 kernel on AMD64 processor - http://linuxpae64.sourceforge.net/ - but it doesn't look like it's got very far into the mainline kernel.

Is there a particular reason you only want to produce 64-bit binaries?
If it's to access extra memory, then the 32-bit OS wouldn't be able to give you extra memory anyway.
If it's to avoid have to test 2 different versions, then just produce the 32-bit version, it'll work on Windows AMD64, and most Linux AMD64 distributions without problems.

like image 116
Douglas Leeder Avatar answered Oct 01 '22 19:10

Douglas Leeder