Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends:

I am in the trenches of writing windows application program and I do not know how to include 32 and 64 bit system configuration in my program. I would be really happy if any one can help me to handle this challenge.


Warmly Regard.
Posted

In addition to the solution by Mehdi and important note by Simon:

You cannot mix up different instruction-set architectures in one process. Supported are two 64-bit instruction-set architectures: Itaniun (IA-64, http://en.wikipedia.org/wiki/Itanium[^];) and x86-64 (http://en.wikipedia.org/wiki/X86-64[^]) as well as 32-bit (x86), which is provided on 64-bit versions of Windows via WoW64 (http://en.wikipedia.org/wiki/WOW64[^]). Both 64-bit architecture are incompatible to each other, but x86 on each of 64 versions of Windows is the same, so it's often uses as a common denominator.

If you break this rule, it's worse than just incompatibility: the solution can be built but will crash during run time.

If at least one of the referenced assemblies uses different instruction-set architecture, it will also crash. AnyCPU is interesting: when all assemblies are targeted to AnyCPU, actual instruction-set architecture will be selected by OS, but if an entry assembly is targeted to specific instruction-set architecture, it will make the choice. This is very important feature helping to run and, say, test library assemblies for different machines.

—SA
 
Share this answer
 
Comments
Espen Harlinn 18-Oct-11 19:27pm    
Good point :)
Sergey Alexandrovich Kryukov 18-Oct-11 19:58pm    
Thank you, Espen.
--SA
BillWoodruff 18-Oct-11 19:34pm    
If you are implying that the OP has the option to compile for Itanium, I suggest you examine: http://en.wikipedia.org/wiki/Itanium#Software_support
Sergey Alexandrovich Kryukov 18-Oct-11 19:58pm    
Does not really matter. You see, all of most of the software should be ready to run on any instruction-set architecture supported; the whole point of the answer by Mehdi and myself is being agnostic about the architecture.
--SA
Mehdi Gholam 19-Oct-11 2:20am    
My 5! is anyone using ia64?
In .net if you go for the Any CPU you don't need to worry about 32 and 64 bit as your assembly will work with both and the runtime installed on your target system will do all the work.
 
Share this answer
 
Comments
Simon Bang Terkildsen 18-Oct-11 15:34pm    
My 5. You will run into problems though when you use native dlls, see Dealing With Native DLLs in .NET “AnyCPU” Builds for a way to deal with that problem.
Mehdi Gholam 18-Oct-11 15:43pm    
Yep that is the only pain point.
Sergey Alexandrovich Kryukov 18-Oct-11 17:26pm    
This is extremely important point, Simon. However, there is a lot more to it.
Please see my answer.

Mehdi got my 4 this time.
--SA
Espen Harlinn 18-Oct-11 19:27pm    
Nice reply :)
Mehdi Gholam 19-Oct-11 2:19am    
Thanks Espen.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900