views:

1493

answers:

4

How do I develop a 64bit app on a 32 bit PC?

I'm using VS 2008 on WinXP 32 bit. I set the visual studio linker to /machine:x64 and created x64 configurations. All will compile and link OK, but when I run the dependency walker on the exe I see the 64 bit mscvr90.dll, etc. pointing to all the Win32 dlls, Kernel32.dll, Advapi32, Comdlg32, Gdi32, etc.

When I copy the exe over to run on a Win64 system it is rejected "...application configuration is incorrect". How do I tell visual studio to stay away from the 32 bit realm?

+2  A: 

Sure you can. More info:

Koistya Navin
None of those links seem relevant for native (mscvr90.dll) runtime problems, and the poster already has the cross-compiling part sorted out?
snemarch
@snemarch, you think he is not missing some 64-bit components?
Koistya Navin
As noted in my answer, I think he's missing the VS2008 native redist, not the CLR :)
snemarch
@snemarch, agreed.
Koistya Navin
there, that gets you an upvote from me :)
snemarch
A: 

Your problem with "rejected" executable is probably that you lack a correct manifest file, and/or that the vc2008 runtimes haven't been (properly) installed on the system. You probably need this runtime package (VS2008 native redistributables, x64 version) on the target system, if not using a .msi based install.

Even in 64bit windows, the DLLs still have their 32bit names (which imho was a bad choice, since it obviously confuses people). 32bit applications will by default have %systemroot%\system32 redirected to %systemroot%\syswow64 (where the 32bit DLLs reside), whereas 64bit applications won't get redirected. Registry access by 32bit applications also has some redirection involved. Both can be disabled per-thread with Wow64DisableWow64FsRedirection(), but obviously doesn't let 32bit applications load 64bit DLLs.

snemarch
just curious, why did you think it was a bad choice? Is it because it's hard to tell if the file you are looking is 32 or 64 bit without running it or using a tool to inspect the file, or other?
JohnW
John> yep, that's part of the reason. My biggest gripe is with the redirection though, would make more sense to have a system64. Using *32.dll names for 64bit apps unfortunately does make a bit of sense (LoadLibrary + GetProcAddress).
snemarch
A: 

Since you are using VS2008, you will either have to copy the redist package along with your application on to the test machine or compile the runtime as a static library within your code.

dirkgently