We all know that some Windows software has been produced for 32 Bit architectures, while other software has been produced for 64 Bit architectures. We also know that Windows software for 32 Bit architectures nicely runs on 64 Bit architectures, while the opposite is not true. Finally, we should also be well aware that mixing executables and DLLs built for different architectures is a guaranteed receipt for disaster.
For a system to work smoothly under Windows, ALL system executables and DLLs MUST be built for an architecture supported by the machine where the system is run. In other words, if your target machine has a 64 Bit hardware architecture AND it is running a 64 Bit Windows version, then you can run either 64 Bit or 32 Bit software on such machine. However, if your target machine is running a 32 Bit Windows version, even if the machine has a 64 Bit hardware architecture you can only run 32 Bit software on such machine.
In any case, it is paramount to check whether your Windows executables and DLLs are natively 64 or 32 Bit, so that you do not end up with compilation, linkage, and runtime nightmares. Unfortunately, checking whether a Windows executable or DLL is 64 or 32 Bit native is complicated. Various web posts point either to chunks of source code or to empirical methods that can be used to see whether a Windows executable or DLL is built for 64 or 32 Bit architectures.
Luckily, Nathan Osman (see the bottom of this stackoverflow post) has produced a small Windows application called PE Deconstructor which checks any Windows executable or dll to determine whether it has been compiled for a 32 Bit or for a 64 Bit Windows environment. I have used it to check executables and DLLs compiled using both 32 and 64 Bit versions of the MinGW-64 toolchain and it works perfectly fine.
Last revised by EC 16/1/2015