Friday, October 14, 2005

x64 v.x86

I just got a new machine recently that has a Xeon proc with x64 architecture. I figured I should be forward looking. I also didn't really know what I would be getting into with program compatibility - especially with my own programs.

1. Most programs will run just fine in WOW64. Actually, why they don't all run is a mystery to me, but I bet sometimes its overactive processor architecture checking as I get stopped by the installer which tells me the program just won't run on my machine, or the program stops itself as it runs the first time. I have yet to see the program that has some fatal error when it tries to run. Since I can run programs that are easily 5 years old, I would guess any program would run. Obviously, if a program is dealing directly with the processor, or something in the 32 bit WinAPI I suppose there could be problems. But, again I don't really *get* the whole issue.

2. Developing in the .net framework held a few mysteries as well. When I installed I got the 64 bit version of the framework, and the x86 version. The 64 is my default framework and unless pointed to the 32-bit, everything runs as 64. This makes app-dev straightforward as things are marked "agnostic" or "Any CPU" in the MSIL and the proper framework is loaded when the program is run - no matter if my compiled programs are moved to a 32-bit machine.

The problem comes in when a program I compile agnostically calls on assemblies which are compiled to target the x86 framework. My program starts up a 64-bit process, and then calls on an assembly to load in that process. It is strictly x86 and fails to load with System.BadImageFormatException. So, I have to compile to an x86 config so my process gets loaded in wow, and targets the x86 framework. There seems to be more to it than this, and you can still get f'd by other people's .net stuff that has been compiled agnostically. I am looking into what to do about this. Probably some config file settings.
Submit this story to DotNetKicks

No comments: