View Single Post
Old 09-04-2008   #6 (permalink)
Pavel Minaev


 
 

Re: Adding Files/Links To Projects

"Jeff Gaines" <whitedragon@xxxxxx> wrote in message
news:xn0fus1y071ota001@xxxxxx
Quote:

> What about a strategy similar to the above that would enable me to switch
> between x86 and x64? Each included project can be switched between x86 and
> x64 but the 'main' project needs a reference to the class file (dll) that
> the included project produces, which are different for x86/x64. Is it
> possible to have a means whereby a project can easily be switched back and
> forth or is it better to just have an x86 project and an x64 project?
>
> I like compiling and testing for x64 because it is totally unforgiving,
> careless use of an 'int' instead of 'uint' and there are pieces of
> computer everywhere - so it is a good discipline for me!
If you're using C#, then you should not see any difference whatsoever
between x86 and x64 in managed code. Given that sizeof(int)==sizeof(uint)==4
regardless of the platform, I don't understand what you mean by "careless
use of 'int' instead of 'uint'".

Furthermore, your assemblies shouldn't even be x86- or x64-specific - the
default target platform for a C# project created in VS is "Any", which is
precisely what it says - it will happily run on either OS, and will be
JIT-compiled to native code for the corresponding architecture.

The only case when a .NET assembly is platform specific is when it uses
P/Invoke or COM interop to call into a native DLL/component, and that
component is only available for a specific platform. For example, when you
call user32.dll via P/Invoke, your assembly is still fine, because on 32-bit
OS it will load 32-bit user32.dll, and on 64-bit OS it will load 64-bit
user32.dll. But if you P/Invoke into some custom .dll, which you
redistribute with your application, and which is 32-bit only, then, when
your assembly is loaded and executed on 64-bit OS using 64-bit version of
..NET, it will crash when it'll try to invoke that 32-bit DLL - and that's
when you set the target platform for your assembly to "x86", so that even on
64-bit, it gets JIT-compiled to 32-bit code and run via WoW64.


My System SpecsSystem Spec