views:

1749

answers:

3

I'd like to configure visual studio 2005 to copy .dll's based on whether the OS is 64-bit or 32-bit during a build.

I do not want to specify what the platform target is.

My first attempt was to use a batch file to lookup the Windows version, but some 32-bit and 64-bit versions of Windows share the same version number.

Anyone know of any way to check this?

Thanks!

+5  A: 

Check out isWow64, I think that shopuld give you what you are after.

Determines whether the specified process is running under WOW64.

Re0sless
+5  A: 

You should be able to read the environment variable %PROCESSOR_ARCHITECTURE%. Here is some great information on it.

http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx

Jon Tackabury
A: 
sizeof(void*)

http://en.wikipedia.org/wiki/64-bit#64-bit_data_models

Kapil Kapre
That would imply that the determination would happen at compile time. In which case, one could simply use the _WIN32 and _WIN64 #defines.
Christopher Dolan