如何读取 C++ 中的 IL
我想知道如何从托管库或可执行文件中读取 IL,并解析文件中的元数据,类似于 Mono.Cecil 的工作方式。我这样做的原因是将一些 .NET 代码移植到 Android(以及其他一些平台),而不必为 Mono 支付高昂的费用。我想知道这些文件中使用的 IL 代码是否记录在某处。 Mono的解析器看起来很乱。我想阅读实际的规范,而不是它的 C# 实现。
I would like to know how it is possible to read IL from a managed library or executable, and parse the metadata in the file, similar to how Mono.Cecil works. The reason I am doing this is to port some .NET code to Android (and a few other platforms), without having to pay the outrageous fee for Mono. I am wondering if the IL code used in these files is documented somewhere. Mono's parser seems to be very messy. I'd like to read the actual specification, instead of a C# implementation of it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有很多 IL 反编译器和工具;阅读您想要的任何说明或元数据应该相对容易,并用它们做任何您想做的事情。
...但是...
大多数.Net 工具本身都是用.Net 编写的。如果您愿意在 Windows 工作站上执行您需要的任何操作(然后将最终输出复制到目标设备),这很好。
至于找到一个实际在你的 Android 目标上运行的反编译器库或工具......这有点问题:)
无论如何,看看这里:
http://wiki.sharpdevelop.net/ILSpy.ashx
祝你好运!
There are plenty of IL decompilers and tools out there; it should be relatively easy to read whatever instructions or metadata you want, and do with them whatever you want.
... BUT ...
Most of these .Net tools are themselves written in .Net. Which is fine, if you're willing to whatever you need on a Windows workstation (then copy the final output to your target device).
As far as finding a decompiler library or tool that actually RUNS on your Android target ... that's a bit more problematic :)
Anyway, have a look here:
http://wiki.sharpdevelop.net/ILSpy.ashx
Good luck!
我不明白为什么你需要反编译任何东西,你没有自己的程序集的源代码吗?您无需反编译它们即可将它们移植到 C++。
如果您尝试反编译不属于您的 .NET 程序集,那么这听起来像是盗窃版权。
此外,Mono 是自由软件。如果您正在编写自由软件(即遵守 LGPL 许可证的条款),您可以在 Android 上使用普通 Mono,而不需要商业 Mono4Android 许可证。
换句话说:只有当您不遵守自由软件许可证的条款时,您才需要付费(如果您问我,这是相当公平的)。
I don't understand why you need to decompile anything, don't you have the source code to your own assemblies? You don't need to decompile those in order to port them to c++.
If you are trying to decompile .NET assemblies that you do not own, then that sounds like copyright theft.
Also, Mono is Free Software. If you are writing Free Software (i.e. comply with the terms of the LGPL license), you can use vanilla Mono on Android and don't need a commercial Mono4Android license.
In other words: You only have to pay if you do not comply with the terms of the Free Software licenses (which is pretty fair if you ask me).