64-bit and 32-bit program configuration under VS201364-bit programs are generated under Windows 7 64bit and Visual Studio 2013.
- Create a new visual Studio Win32 console project named WinTestX64.
The code is as follows
#include"stdafx.h"#include<iostream>using namespacestd;#definePRINT (a) cout << #a << ":" << a << EndlvoidPrintSize (Charainfunc[]) {PRINT (sizeof(Ainfunc));}int_tmain (intARGC, _tchar*argv[]) { CharA[] ="ABC"; Char*b ="ABC"; PRINT (sizeof(a)); PRINT (sizeof(b)); PrintSize (a); GetChar (); return 0;}
- Click Solution Platforms on the toolbar, select Configuration Manager ..., and then select <New...> in Active solution platform
- Select the "x64" platform in the "New Solution Platform" dialog box. Click OK.
- Back to the IDE interface, notice that the platform is now x64.
- Compile, link, generate 32-bit and 64-bit programs, respectively.
- Press F5, start debugging, in the output dialog, we can see that the 32-bit and 64-bit programs load the DLLs differently. The 32-bit program loads the DLL from SysWOW64.
The 64-bit program loads the DLL from System32.
Compile with 32bit and 64bit configuration respectively to see the difference between the results.
64-bit and 32-bit program configuration under VS2013