Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 375 Vote(s) - 3.56 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the purpose of the "Prefer 32-bit" setting in Visual Studio and how does it actually work?

#1
![Enter image description here][1]

It is unclear to me how the compiler will automatically know to compile for 64-bit when it needs to. How does it know when it can confidently target 32-bit?

I am mainly curious about how the compiler knows which architecture to target when compiling. Does it analyze the code and make a decision based on what it finds?

[1]:

Reply

#2
The reason is: in case you don't want to use more memory with 64 bit applicatios. Which means, if your application is *AnyCPU*, you want to run as 32 bit.

To add more, the setting in Visual Studio targets the particular CLR:

> Visual Studio installs the 32-bit version of the CLR on an x86 computer, and both the 32-bit version and the appropriate 64-bit version of the CLR on a 64-bit Windows computer. (Because Visual Studio is a 32-bit application, when it is installed on a 64-bit system, it runs under WOW64.)

Please refer to the article *[64-bit Applications][1]* ([MSDN][2]).

[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply

#3
Microsoft has a blog entry *[What AnyCPU Really Means As Of .NET 4.5 and Visual Studio 11][1]*:

> In .NET 4.5 and Visual Studio 11 the cheese has been moved. The
> default for most .NET projects is again AnyCPU, but there is more than
> one meaning to AnyCPU now. There is an additional sub-type of AnyCPU,
> “Any CPU 32-bit preferred”, which is the new default (overall, there
> are now five options for the /platform C# compiler switch: x86,
> Itanium, x64, anycpu, and anycpu32bitpreferred). When using the "Prefer 32-Bit"
> flavor of AnyCPU, the semantics are as follows:
>
> - If the process runs on a 32-bit Windows system, it runs as a 32-bit process. IL is compiled to x86 machine code.
> - If the process runs on a 64-bit Windows system, it runs as a 32-bit process. IL is compiled to x86 machine code.
> - If the process runs on an ARM Windows system, it runs as a 32-bit process. IL is compiled to ARM machine code.
>
> **The difference, then, between “Any CPU 32-bit preferred” and “x86” is
> only this: a .NET application compiled to x86 will fail to run on an
> ARM Windows system, but an “Any CPU 32-bit preferred” application will
> run successfully.**

[1]:

[To see links please register here]

Reply

#4
Here's a simple answer:<br/>

[![Application arch.][1]][1]


[1]:


**Note:** AnyCPU-32bitPreferred is only available in .Net version 4.5 and higher.
Reply

#5
When I had 32 bit preferred checked, when run on our server, it was trying to use the 32 bit db driver instead of 64 bit that we had installed, so it wasn't connecting to the db when we ran it, so queries were failing because of failure to connect.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through