How to generate IL source code with csc (C# compiler) or dmcs (mono C# compiler)?

你说的曾经没有我的故事 提交于 2019-12-01 05:12:10

问题


gcc has an option of -s to generate assembly source code. Does csc (MS C# compiler) or dmcs (mono C# compiler) have equivalence? I mean do those compilers provide an option to generate IL source code that can be read not the execution binary?


回答1:


It's very easy to get to the IL: just use ildasm. The /text option prints the result to the console, which you can divert to a file.




回答2:


A C# compiler always generates IL (CIL in the case for .net), because thats the way .net works, but if you mean you want to precompile this in to machine code to speed up execution you can use ngen.exe (see HERE).

If you just want to see the generated IL you can use ILSpy.



来源:https://stackoverflow.com/questions/7231983/how-to-generate-il-source-code-with-csc-c-compiler-or-dmcs-mono-c-sharp-comp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!