Why are there four mono C# compilers?

前端 未结 2 1277
日久生厌
日久生厌 2021-02-01 21:00

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

To me, it\'s a little bit weird to have four C# compilers. As normally the newer versio

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-01 21:50

    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.

    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.

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

提交回复
热议问题