tags:

views:

254

answers:

9

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.

+6  A: 

On windows, only using a virtual machine.

On OS X, 64Bit apps run natively (thanks Stephen)

Otto Allmendinger
who is downvoting all these answers without providing a correction?
Otto Allmendinger
@Otto Allmendinger +1 - Somones downvoting all answers, including my own. and I cant see why. If we are wrong please provide the correct solution.
Pino
@Pino: I think somebody tried to get his answer to the top at the beginning by downvoting all the other answers
Otto Allmendinger
@Otto Allmendinger - Stupid and defeats the object of this. Comments should be required.
Pino
This is true on Windows, but not true on all OS's. OS X, for example, will run 64-bit binaries on the 32-bit kernel.
Stephen Canon
+4  A: 

The other way around is fine, bit I dont think you can run a 64bit app on a 32bit OS, you may be able to using a virtual machine or some kind of virtualisation.

Pino
Why did this get downvoted?
Pino
This still has a downvote, can anyone explain why?
Pino
Depends on the OS. It won't work on Windows, but it will work on OS X.
Stephen Canon
+1  A: 

See this (assuming you're running Windows):

If the program is specifically designed for the 64-bit version of Windows, it won't work on the 32-bit version of Windows. (However, most programs designed for the 32-bit version of Windows will work on the 64-bit version of Windows.)

Device drivers designed for the 64-bit version of Windows won't work on computers running a 32-bit version of Windows. To learn how to check for drivers, see Update a driver for hardware that isn't working properly or go to the device manufacturer's website.

Anton Gogolev
+11  A: 

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

Douglas Leeder
Especially in some cases if you're running the 32-bit host on a 64-bit CPU.
Ignacio Vazquez-Abrams
On the mac, you can also just ship a 64-bit binary, and it will work on both 32- and 64-bit kernels.
Stephen Canon
@Stephen - interesting - I'll edit my answer.
Douglas Leeder
+2  A: 

it is possible using qemu in soft emulation mode

mathroc
+2  A: 

No.

See Microsoft FAQ:

The terms 32-bit and 64-bit refer to the way a computer's processor (also called a CPU), handles information. The 64-bit version of Windows handles large amounts of random access memory (RAM) more effectively than a 32-bit system. For more details, go to A description of the differences between 32-bit versions of Windows Vista and 64-bit versions of Windows Vista online.

Understand the difference between 32-bit and 64-bit and you will see why it's not possible.

Filip Ekberg
What about emulation and virtual machines?
mouviciel
That's not "native" which I guess the OP asks about.
Filip Ekberg
@mouviciel: Then the 64-bit program would be running on an emulated or virtual 64-bit platform instead of running on a 32-bit platform.
Roger Pate
+3  A: 

There's an easier solution than trying to run a 64-bit program on a 32-bit OS (including executing through an emulated or virtual 64-bit platform on top of the 32-bit OS): recompile it for the 32-bit OS.

When you said it's portable across different OSes, did you also mean non-64-bit OSes? I could not call something portable without qualifying "only 64-bit" if that was the case, and I think many (maybe even most?) programmers also expect that qualification, at least currently.

Roger Pate
+1  A: 

On Windows, no. On OS X, yes. I don't know what the state of affairs is on Linux.

In fact, Snow Leopard boots into a 32-bit kernel, but compiles applications 64-bit by default, so this is quite common on OS X.

Stephen Canon
+1  A: 

A 64 bit application does not run on a 32 bit processor period

A 64 bit application uses a 64 bit wide register. It just plain won't fit.

kurtnelle