Search code examples
c#c++pinvokeunmanaged

Reverse PInvoke and create a full unmanaged C# program


I know this is a strange question but the idea is simple: I prefer C# syntax rather than C++: -Setters and getters directly inside a property -interfaces -foreach statement -possibility to declare an implicit cast operator

other small things...

What I really don't know is if is possible to import a c++ dll (expecially std libraries) in C# if I don't use any namespace (even System)

The idea is just to write a program using everything that you will normally use in C++ (nothing from CLR so), even printf for example

Thanks for any answer


Solution

  • There's now something close to this

    .NET Native compiles C# to native machine code that performs like C++. You will continue to benefit from the productivity and familiarity of the .NET Framework with the great performance of native code.

    It's for Windows Store apps only (desktop apps may come in the future):

    Desktop apps are a very important part of our strategy. Initially, we are focusing on Windows Store apps with .NET Native. In the longer term we will continue to improve native compilation for all .NET applications.

    And

    apps will get deployed on end-user devices as fully self-contained natively compiled code (when .NET Native enters production), and will not have a dependency on the .NET Framework on the target device/machine