0

Reading Microsoft explanation for different option for /platform, I found that when I use /platform:anycpu, it will run as 32 bit application on 32 bit system and 64 bit on 64 bit systems.

So why should I force it to use for example x64?

Is there any reason that people may use other options?

mans
  • 17,104
  • 45
  • 172
  • 321

3 Answers3

1

The must important and useful different is in memory management. x86 applications cannot allocate more than 4GB of RAM. But x64 apps can. and also:

It is related on how the CLR will execute your code when is implemented. Remember that CLR compiles your code on the fly, while is first requested the IL code is assembled into machine code and then cached (that's why the first access is slower on your applications). Now, if you select x86, you are flagging your code that your application will run on a x86 processor, therefore the CLR can use assembler functions that are exclusively for that type of processor (taking performance advantages). The same happens if you select x64, where the registers are bigger and there are new x64 functions that can speed up your application. If you select "Any" the CLR will not use any CPU specific function and will hold to the standard set of instructions.

Reference: Project setting CPU: x86, x64, Any CPU

Hope this helps to understand.

Mohammad Mirmostafa
  • 1,720
  • 2
  • 16
  • 32
0

It's important when you try to load dll's made with c++ for example. I have a particular case when i can't execute my program when compiled in x64 or Any CPU but it works fine in 32 Bit.

In other cases when you make a dll for a ASP.Net page. If you Compile it in 32 Bit you have to configure the IIS to load them correctly.

Bongo
  • 2,933
  • 5
  • 36
  • 67
0

When you are writing an app that should only execute on a 64 bit OS. ie when it gets jitted you need 64 native code for some reason.

One reason would be you want to load a 64bit only native dll which can't be loaded into a 32 bit process. e.g. it's not a .net dll.

Tony Hopkinson
  • 20,172
  • 3
  • 31
  • 39