Dajbych.net


Windows 8 will show the benefits of the .NET platform

, 2 minutes to read

windows 8 logo

While it doesn't really matter whether an application is written in C++ or C#, Windows 8 is starting to show us that using a cross-platform framework built into the operating system makes a lot of sense. Only .NET applications will be able to run on all three platforms supported by Windows 8. A C++ application can be recompiled, but so must the third-party library manufacturers that the application uses.

Windows 8 also runs on ARM processors, which are widely used in portable handhelds. Just as the Itanium, AMD64 and ARM processor architectures differ, so do their instruction sets. Therefore, C++ applications must be compiled specifically to one of them. The problem is not that the application cannot be recompiled for another instruction set. The problem arises when for some reason there is no recompiled library that is maintained by someone else.

Similar problems have occurred in the past, and the solution was an abstraction over an instruction set called MSIL. All high-level .NET languages such as C# or PHP are translated into this instruction language. JIT translates MSIL into a specific processor instruction set. All libraries that are compiled into MSIL are therefore multiplatform. The only exceptions are when the assembly calls some other libraries that are platform-dependent.

There are cases where multiple instruction sets are offered and the application works only in one of them. For example, compiling for AMD64 on 64-bit Windows can be done to both x86-32 and x86-64. In the case of x86-32, the WOW64 emulator is used, which ensures that native 32-bit applications run on a 64-bit operating system. This allows the application to call 32-bit native libraries. Therefore, a flag can be inserted into assembly that requires compilation for a specific instruction set. In practice, this is used to force a .NET application to run on 64-bit Windows in 32-bit mode. Libraries that have the flag set incorrectly or completely unnecessarily can be easily edited using the CorFlags tool.