Executing 32-bit applications on 64-bit

[go to https://blogs.msdn.com/volkerw/archive/2008/07/24/executing-32-bit-application-in-64-bit.aspx for updated links]

64-bit will soon be everywhere.
So, will all application have to be rewritten?

I guess not. Windows on Itanium, AMD-64 or Xeon EM64T supports the execution of 32-bit applications. You can install programs like WinWord, Excel and many many other non-MS applications w/o any problems on a 64-bit Windows OS. These applications will just run as they would on 32-bit Windows. From an executable’s perspective it is just Windows.

That said, if you want your application to take full advantage of the 64-bit OS, you will have to migrate your source code to 64-bit. And if we talk about typical server applications that need to be very responsive or serve lots of clients – typical service applications – even though you can install them on 64-bit, a migration to 64-bit is highly recommended. In any case, there is no rule of thumb or general advice if, when and how to migrate to 64-bit. Just be aware that the near future will be 64-bit. Migration to 64-bit always implies either a migration to native 64-bit code or to the .Net framework. With the next generation of Visual Studio, Visual Studio 2005 (codename Whidbey) MS will ship the .Net framework for the 64-bit operating systems.

Back to the original question: Will all applications have to be rewritten to run on a 64-bit Windows operating system?

The precise answer to this question is: Yes and No. This blog will focus on the latter part of the answer. AMD’s 64-bit Athlon and Opteron processors are designed in a way that allows 32-bit opcodes to be executed natively on the chip like they would be on a 32-bit processor. The same is true for Intel’s Xeon EM64T. For Itanium the story is slightly different. Even though there is on die (on the processor chip) support for x86 code, Intel introduced what they called an EL or Emulation Layer. The EL is a layer helping the 64-bit CPU to “understand” the 32-bit opcodes.

The Windows operating system introduces a very slim layer, implemented in a set of DLLs, to give 32-bit applications access to the 64-bit OS. This layer is called WOW64 (Windows-on-Windows 64-bit) and does all the magic necessary to make 32-bit applications feel good on 64-bit Windows.

WOW64 and the built-in support of 32-bit on the processor enable the execution of 32-bit application in a 64-bit Windows environment. If you are interested in more details about 32-bit application installation and execution, below I put some reference information.

MSDN: WOW64 Implementation Details
MSDN: Running 32-bit Applications
AMD: WOWing Your 32-Bit Applications with 64-Bit Windows Part 1
AMD: WOWing Your 32-Bit Applications with 64-Bit Windows, Part 2
Intel: Getting Software Ready for Intel® Itanium® Architecture
Intel: IA-32 Execution Layer (EL)