简体   繁体   English

如何使用csc(C#编译器)或dmcs(单声道C#编译器)生成IL源代码?

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

gcc has an option of -s to generate assembly source code. gcc有一个-s选项来生成汇编源代码。 Does csc (MS C# compiler) or dmcs (mono C# compiler) have equivalence? csc(MS C#编译器)或dmcs(单声道C#编译器)是否具有等价性? I mean do those compilers provide an option to generate IL source code that can be read not the execution binary? 我的意思是那些编译器提供了生成可以读取而不是执行二进制文件的IL源代码的选项吗?

It's very easy to get to the IL: just use ildasm . 到IL很容易:只需使用ildasm The /text option prints the result to the console, which you can divert to a file. /text选项将结果打印到控制台,您可以将其转移到文件。

AC# 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 ). AC#编译器总是生成IL(在.net的情况下是CIL ),因为这就是.net的工作方式,但如果你的意思是你想将它预编译到机器代码中以加速执行,你可以使用ngen.exe(参见这里 )。

If you just want to see the generated IL you can use ILSpy . 如果您只想查看生成的IL,可以使用ILSpy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM