Can I create a Win32 application in C #?

4

I am aware that C # is the right arm of the .NET Framework, and that the default language for programming Win32 applications is C ++. But, can I program an application in C #, regardless of any .NET Framework library?

In other words, I can create a fully written C # application that does not use any .NET Framework library , so it can run just runtime in> Windows, not the .NET Framework?

    
asked by anonymous 08.08.2017 / 05:53

1 answer

6

Being independent of the .NET Framework is different from being independent of anything.

You can create a native executable using C # or another standard .NET language with .NET Native . It is a set of tools that allows you to convert the CIL to native platform binary. Of course you have a library that acts like the runtime of the language that is needed. By C # requirement this can not be that small, but it is much smaller than the .NET Framework and can be contained within the native executable itself.

This requirement of not having anything else can only be met by Assembly in more or less C, even though doing something very basic. Understand how .NET works . It can reduce part of the entire infrastructure, but you can not eliminate everything without making it impossible for the language to be what it is, to give the security normally offered.

You can not function without several of the BCL classes. Language is supported over many of them, and even those that are not language-dependent are still used in most applications. Of course, a self-contained executable need not have more than the code used, you do not need to load all BCL or FCL . Same in every language. Even C depends on a library. I just can not tell if it's smart enough to separate what it uses in each class or need to put it all, or still whole compile unit if it's a linker . You have a case that can not even run the risk of eliminating certain things.

Of course, some features can be compromised without the full platform. Reflection itself is a bit limited, but in native executable it has little service anyway.

You also have LLILC using LLVM .

There are other ways to use the middle ground where you do not need the .NET Framework installed on the machine, but it can not even be a native executable. This could be .NET Core , or Mono , some templates from Xamarin . On iOS or Xamarin it generates native code . All of them are independent of the .NET Framework or another platform that needs to be preinstalled.

The .NET Framework is just one way to serve C #.

    
08.08.2017 / 14:02