可以轻松地反编译C ++.Net程序集吗? [英] Could C++.Net assemblies be decompiled easily?

查看:230
本文介绍了可以轻松地反编译C ++.Net程序集吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道所有程序集都可以通过某种方式反编译,但是C#&使用(.Net Reflector)之类的工具,最容易将VB应用程序反编译为源代码.

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 ).

所以我的问题是,如果我使用.Net程序集和带有C ++的函数对应用程序进行编程,是否容易像使用.Net反射器和此类工具的C#或VB应用程序那样对它进行反编译? 好吧,如果我在不使用.Net框架任何功能的情况下对其进行编程,并且仅将UI称为.Net程序集,那么也很容易崩溃?

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 ?

我想使用.Net和C ++将我的应用程序编译成Native&托管代码!

I want to use .Net and C++ to make my application compiled into both Native & Managed code!

推荐答案

没有"C ++.Net".有C ++/CLI,它是一种类似于C ++的语言,可用于将本机C ++代码与.NET粘合在一起.您在其中编写的托管代码(引用类)将被编译为MSIL. 本机"代码将编译为MSIL或本机代码.如果您想将某些部分编译为本机代码,则需要

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)

在您的来源中. 管理的编译指示可用于选择每个功能的编译目标.或者,您也可以不使用每个模块的/clr标志进行编译,然后将您的项目设置为生成混合模式程序集.

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.

请注意,将本机类型编组为.NET并回传可能会对应用程序造成严重的性能损失-并且这种情况每次您跨越本机管理的边界时都会发生.但是,此类嵌入式本机代码和托管代码之间的互操作比正常的p/invoke快得多.

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.

另请参阅以下问题: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆