views:

70

answers:

3

I recently received a PC running Windows 7 for future development as this will be closer to our production environment. I was in the middle of working on a solution on my old machine (Windows XP 32 bit), but decided to start working on it with the new box to try to work out any kinks. I have visual studio 2008 installed on both boxes.

The solution I'm working on uses NServiceBus which 32 bit. The oracle drivers installed on the dev box are 64 bit though and this has been giving me a lot of trouble. I get run time errors that NserviceBus can't load the 64 bit oracle dll. I have tried every combination of Solution Platform and Target Platform I can think of. I did actually get it working perfectly about a week ago, but I have since undid changes and reloaded a shelveset and I can't get it working again.

I'm looking for some general guidelines, hints, and tips for working in this mixed environment. Do I need to go back and set projects to build as 32 bit if a project that references them makes use of a 32 bit assembly? Etc. Thanks for any guidance.

+2  A: 

You need to be homogeneous in DLL and executable format - if one is 32bit, everything needs to be 32bit. If one is 64bit, everything needs to be 64bit.

The only exception is managed code: if set for "Any CPU", it can be loaded by a 32 or 64 bit process.

Yann Ramin
managed code isn't an exception, it's more like Schrödinger's cat.
Ben Voigt
+2  A: 

32- and 64-bit code cannot both exist in the same process.

If you need to use a 32-bit DLL from a 64-bit program (or vice-versa), you will need to spawn a new process and use some inter-process communication (IPC) technique.

BlueRaja - Danny Pflughoeft
+1  A: 

This is a problem I've run into with the ASCOM (Astronomy Common Object Model) Platform. Basically, if there is one single 32-bit dependency, then all of the code has to be 32-bit. In our case though, we don't necessarily own the client application so we can't control whether it will be 32-bit or 64-bit, so we have had to rigorously remove all 32-bit dependencies from our code and compile everything for 'Any CPU'.

alt text

Some of the ideas we explored in ASCOM are documented on my blog, Electric Dreams.

Tim Long
Thanks, the info in the link helps a lot.
Justin Holbrook