Can I port code to a 64-bit platform under a 32-bit platform?
Yes, you can do this if you use a cross-compiler that creates a native code for a platform different from that on which your code is executed.
For Visual C++, for example, you can use X86_amd64 and X86_IA64 cross-compilers included into the Windows SDK pack to create 64-bit binary files in a 32-bit Windows.
Remember that mere recompilation (even if you checked all the compiler warnings) is usually not enough for correct port of a real project to another platform. A code that has been working correctly on the initial platform may become incorrect after being recompiled for another platform.
Detection of porting errors should be started at the stage of code editing/recompilation already - it is possible if you use the static analysis methodology, for example. It will allow you to carry out the initial project migration stage using the cross-compiler without launching the program on the target platform.
- Wikipedia. Cross compiler.
- Andrey Karpov. Seven Steps of Migrating a Program to a 64-bit System.
- Andrey Karpov, Evgeniy Ryzhkov. Lessons on development of 64-bit C/C++ applications.