/ .net

Native x64

Your managed code will by default take advange of the extra processor functionality when running under Windows x64. This means a nice "free" performance boost. Except if your process depends on native Win32 dlls, as these cannot be loaded. Only dlls compiled for x64 can be loaded into a 64 bit process. This little C++.NET example shows how to determine the library to load at runtime depending of the process bitness. I.e. on Win32 and x64 it will use Interopx86.dll and Interopx64.dll respectively.

#include "StdAfx.h" 
#include <tchar.h> 
#include <windows.h> 

using namespace System; 
using namespace System::IO; 
using namespace System::Runtime::InteropServices; 

ref class TestInterop 
    typedef void (*TestProc)(); 
    TestProc test; 
    HMODULE hModule; 

        String^ assemblyName = "Interop" + (IsWin32() ? "x86.dll" : "x64.dll"); 
        IntPtr pAssemblyName = Marshal::StringToHGlobalUni(assemblyName); 
        LPCWSTR szAssemblyName = (LPCWSTR)pAssemblyName.ToPointer(); 
        hModule = ::LoadLibraryW(szAssemblyName); 
        if (hModule==NULL) 
            throw gcnew FileNotFoundException("LoadLibrary failed"); 
        test = (TestProc) ::GetProcAddress(hModule, "Test"); 
        if (test==NULL) 
            throw gcnew MissingMethodException("Test is missing"); 
    void Test() 
    virtual ~TestInterop() 
        hModule = NULL; 
    static bool IsWin32() 
        return sizeof(void*) == 4; 

int main(array<System::String ^> ^args) 
    TestInterop iop; 
    return 0;