When compiling x64 code, what's the difference between "x86_amd64" and "amd64"?

Meta picture Meta · Aug 18, 2010 · Viewed 28.1k times · Source

When compiling code with VC++, MSDN gives you the option between using the x86_amd64 toolset or the amd64 toolset (when calling vcvarsall.bat).

How do I choose between those two when compile x64 code? Will the amd64 option churn out more efficient x64 machine code than the cross compiler?

Answer

joshperry picture joshperry · Aug 18, 2010

It has nothing to do with efficiency. The native and cross-compiler will both generate the same machine code. You will however gain some benefits by running a native 64-bit compiler process on a 64-bit workstation (larger registers, larger memory space, etc...).

The native compiler will only run on an 64-bit copy of Windows, so if your workstation is 32-bit this compiler won't even run.

The cross-compiler is meant to run on x86 machines even though it will run on a 64-bit copy of Windows via WoW; however, there is no reason to do this.

The page you link says it quite well:

x64 on x86 (x64 cross-compiler)
Allows you to create output files for x64. This version of cl.exe runs as a 32-bit process, native on an x86 machine and under WOW64 on a 64-bit Widows operating system.

x64 on x64
Allows you to create output files for x64. This version of cl.exe runs as a native process on an x64 machine.

Thanks to Brian R. Bondy for the quote formatting