C # for 64bit OS?

How can I make my compilation optimized for Windows 64 bit?

+2
source share
4 answers

A managed project is automatically created in accordance with the selected architecture => the default C # project created on AMD64 will be AMD64, X86 on X86. By default, it is 32-bit by default.

To explicitly install the platform:

1 open the solution explorer, select the solution, right-click-> Configuration Manager.

2 go to the "Active Solutions Platform", click "Create."

3 " " , Itanium. " " " ", " ".

4 "".

WebLog

+4

, :

using System;
using System.Runtime.InteropServices;

class SystemChecker
{
    static bool Is64Bit
    {
        get { return Marshal.SizeOf(typeof(IntPtr)) == 8; }
    }
}
+6

, .

, DLL, Interop 32 . , x86, .

+3

64 /platform. , Express 64- .

. . :

64- Windows:

  • , /platform:x86, 32- CLR, WOW64.
  • , /platform:anycpu, 64- CLR.
  • DLL, /platform:anycpu, CLR, , .

:

.

bool is64BitProcess = IntPtr.Size == 8;
int bitProcess = IntPtr.Size*8;
//C# 4 provides System.Environment.Is64BitProcess
//TimothyP solution:
bool is64BitProcess = Marshal.SizeOf(typeof(IntPtr)) == 8;
+1
source

Source: https://habr.com/ru/post/1705727/


All Articles