Share via


64-bit ApplicationsĀ 

Beginning in Visual Studio 2005 you can compile your application and specify that it should run on a 64-bit operating system either as a native application or under WOW64. WOW64 is a compatibility environment provided by the operating system that allows a 32-bit application to run on a Windows 64-bit operating system.

Remarks

All applications built with the 1.0 and 1.1 releases of the .NET Framework are treated as 32-bit applications and are always executed under WOW64 on the 32-bit common language runtime (CLR) on a 64-bit operating system. In addition, 32-bit specific applications built with version 2.0 of the .NET Framework would run under WOW64 on 64-bit platforms.

Visual Studio 2005 will install the 32-bit version 2.0 CLR on an x86 machine, and both the 32-bit and appropriate 64-bit version 2.0 CLR on a 64-bit Windows machine. (Visual Studio 2005 is a 32-bit application and when installed on a 64-bit Windows operating system will run under WOW64.)

NoteNote

Due to the design of x86 emulation and the WOW64 subsystem for the Itanium processor family, applications are restricted to execution on one processor. Single processor execution and x86 emulation reduce the performance and scalability of 32-bit .NET Framework applications running on Itanium-based systems. It is recommended that applications using the .NET Framework Version 1.1 be used for interactive, client applications, and not for applications that demand high performance or scalability, such as high-load ASP.NET applications. Consider using the .NET Framework Version 2.0, which includes native 64-bit support for Itanium-based systems, for increased performance and scalability.

As with 32-bit Windows operating systems, there is a 2GB limit on the size of an object you can create while running a 64-bit managed application on a 64-bit Windows operating system.

In many cases, assemblies will run the same on the 32-bit or 64-bit CLR. Some reasons for a program to behave differently when run by the 64-bit CLR include:

  • Structs that contain members that change size depending on the platform, such as any pointer type.

  • Pointer arithmetic that includes constant sizes.

  • Incorrect platform invoke or COM declarations that use Int32 for handles instead of IntPtr.

  • Casting IntPtr to Int32.

For more information on porting your 32-bit application to run on the 64-bit CLR, see https://msdn.microsoft.com/library/?url=/library/en-us/dndotnet/html/64migrate.asp.

General 64-bit programming information

For general information about 64-bit programming issues see,

For information about support in the Visual Studio development environment for creating 64-bit applications, see Visual Studio Development Environment 64-Bit Support.

Compiler support for creating 64-bit applications

An application built using .NET Framework 2.0 (on a 32-bit or 64-bit machine) by default will run as a native application (not under WOW64) on a 64-bit machine. The following table lists topics that discuss how to use Visual Studio compilers to create 64-bit applications that will run either as native, under WOW64, or be able to do both.

Compiler Compiler Option

Visual Basic

/platform (Visual Basic)

Visual C#

/platform (Specify Output Platform) (C# Compiler Options)

Visual C++

You can create platform agnostic MSIL applications with /clr:safe; see /clr (Common Language Runtime Compilation) for more information.

Visual C++ ships separate compilers that target each 64-bit operating system. For additional information on using Visual C++ to create native applications that run on a 64-bit Windows operating system, see 64-bit Programming.

Visual J#

The Visual J# compiler can only create 32-bit applications in Visual Studio 2005. When run on a 64-bit Windows operating system, an application compiled with Microsoft Visual J# 2005 will run under WOW64. (The JDK binaries, which the Visual J# compiler has a dependency on, even for applications that do not make JDK calls, is 32-bit.)

If a platform agnostic image loads a Visual J# .dll on a 64-bit Windows operating system, the calling application will fail at runtime.

JScript

/platform (JScript)

Determining the status of an .exe or .dll

Use corflags.exe at the command line to see if it an .exe or .dll is meant to run only on a specific platform or under WOW64. You can also use corflags.exe to change the platform status of an .exe or .dll. See CorFlags Conversion Tool (CorFlags.exe) for more information. A Visual Studio 2005 assembly's CLR header (or COM+ Runtime header) has the Major Run-time Version Number set to 2 and the Minor Run-time Version Number set to 5. In Visual Studio 2003 assemblies, they are 2 and 0, respectively. All applications that have the minor runtime version set to 0 are treated as legacy applications and are always executed under WOW64 on 64-bit machines.

Use the GetPEKind to programmatically query an .exe or .dll to see if it is meant to run only on a specific platform or under WOW64.

See Also

Other Resources

Types of Applications and Components