为什么有四个单声道 C# 编译器? [英] Why are there four mono C# compilers?

查看:15
本文介绍了为什么有四个单声道 C# 编译器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本页解释了四种不同的单声道编译器 - mcs/gmcs/smcs/dmcs.

This page explains about the four different mono compilers - mcs/gmcs/smcs/dmcs.

对我来说,拥有四个 C# 编译器有点奇怪.通常,较新版本的编译器保持向后兼容性.

To me, it's a little bit weird to have four C# compilers. As normally the newer version of compiler maintains backward compatibility.

我认为这是因为运行时支持问题,但微软的 C# 有一个支持所有运行时版本的 csc.exe.

I assume that's because of runtime support issues, but Microsoft's C# has one csc.exe that supports all of the runtime versions.

推荐答案

这是因为 Mono 的编译器是用 C# 编写的并且使用 System.Reflection,这意味着它只能从运行它的运行时访问 mscorlib.因此,例如,smcs 不仅仅针对 2.1,它实际上使用 2.1 corlib 等.

It's because Mono's compiler is written in C# and uses System.Reflection, which means it can only access mscorlib from the runtime that it's running on. Therefore, for example, smcs doesn't just target 2.1, it actually uses 2.1 corlib, etc.

已经有一段时间计划让 *mcs 使用 Mono.Cecil 或 Ikvm.Reflection 而不是 System.Reflection,这意味着可能会有一个带有参数的单个 mcs 编译器针对不同的运行时.

There have been plan for a while to have *mcs use either Mono.Cecil or Ikvm.Reflection instead of System.Reflection, which would mean there could then be a single mcs compiler with arguments to target different runtimes.

微软的编译器没有这个限制,因为它不使用 .NET 反射(它是用本机代码编写的).

Microsoft's compiler doesn't have this limitation because it doesn't use .NET Reflection (it's written in native code).

这篇关于为什么有四个单声道 C# 编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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