I know that all assemblies can be decompiled somehow, but C# & VB applications are the easiest to be decompiled into source code using tools like ( .Net Reflector ).
So my question is, if I programmed an application using .Net assemblies and functions with C++, would it be easy to decompile it as if it was a C# or VB application with .Net reflector and such tools? Ok, if I programmed it without using any function from .Net framework and made UI only what calls .Net assemblies, would be easy to decmpile also ?
My question is similar to this one : Could this C++ project be decompiled with such tools like a .NET Reflector? but no one has answered him correctly, so can anyone help me ?
I want to use .Net and C++ to make my application compiled into both Native & Managed code!
There is no "C++.Net". There is C++/CLI, which is a C++-like language that can be used to glue native C++ code with the .NET world. The managed code you write in it (ref classes) will be compiled to MSIL. The "native" code will compile to either MSIL or native. If you want to compile some parts to native code you need
#pragma managed(push, off)
void foo() {}
#pragma managed(pop)
in your source. The managed pragma can be used to choose the compilation target per-function. Or you can compile without the /clr
flag per-module and set your project to produce a mixed-mode assembly.
Be aware that marshaling the native types to .NET and back can take a serious performance hit on your application - and that happens every time you cross the native-managed boundary. But interoperation between such embedded native code and managed code is much faster than normal p/invoke.
See also this question: C++CLI. Are native parts written in pure C++ but compiled in CLI as fast as pure native C++?
来源:https://stackoverflow.com/questions/17913270/could-c-net-assemblies-be-decompiled-easily