从Unity3D编译器升级聊起Mono
接前篇Unity 5.3.5p8 C#編譯器升級(jí),本文側(cè)重了解一些Mono的知識(shí)。
Unity3D的編譯器升級(jí)
新升級(jí)的Mono C#編譯器(對(duì)應(yīng)Mono 4.4)
Unity編輯器及播放器所使用的Mono運(yùn)行時(shí)還未升級(jí)。
新編譯器仍針對(duì)C# 4,是舊的編譯器也支持的版本。
新編譯器目標(biāo)框架為.Net 3.5,也是之前支持的框架。
Mono是如何運(yùn)行的?
*.cs源文件通過(guò)編譯器編譯成IL(中間文件)
IL 運(yùn)行在Mono的 JIT(just in time)
Mono虛擬機(jī)運(yùn)行在物理機(jī)中
查看Unity使用的Mono版本
參考:http://answers.unity3d.com/questions/259448/how-to-determine-mono-version-of-unity-.html
我在unity 5.3.4f1 中測(cè)試有效,而在unity 4.3.4f1下測(cè)試無(wú)效
using UnityEngine;using System;using System.Reflection;public class MonoVersion : MonoBehaviour { ? ?void Start() ? ?{Type type = Type.GetType("Mono.Runtime"); ? ? ?? ? ??if (type != null){MethodInfo info = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static); ? ? ? ? ? ?if (info != null)Debug.Log(info.Invoke(null, null));} ? ? ?//Debug.Log(System.Enviroment.Version);//net version?} }
方法二
d:\Program Files\Unity_5_34\Editor\Data\Mono\bin>monop2 --runtime-version mono.exe runtime version: 2.0.50727.1433 d:\Program Files\Unity_5_34\Editor\Data\Mono\bin>mono.exe --version Mono JIT compiler version 2.0 (Visual Studio built mono) Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.comTLS: ? ? ? ? ? normalGC: ? ? ? ? ? ?Included Boehm (with typed GC)SIGSEGV: ? ? ? normalNotification: ?Thread + pollingArchitecture: ?x86Disabled: ? ? ?noneMono
Mono是.Net Framework?
.NET和Mono兩者是完全獨(dú)立的,簡(jiǎn)單的理解:Mono項(xiàng)目是第三方的.Net Framework實(shí)現(xiàn),比喻為.Net的跨平臺(tái)版,絕大多數(shù)C#的特性在.net和mono中都是相同的,少部分特性?xún)烧叩膶?shí)現(xiàn)不一致。
Mono的目標(biāo)是創(chuàng)建一系列符合ECMA 標(biāo)準(zhǔn)(Ecma-334和Ecma-335)的.NET 工具,包括C# 編譯器和共通語(yǔ)言執(zhí)行平臺(tái)
Mono 虛擬機(jī)包含一個(gè)實(shí)時(shí)編譯引擎,該引擎可用于如下處理器:x86,SPARC,PowerPC,ARM,S390(32位模式和64位模式),x86-64,IA64?和64位模式的 SPARC。該虛擬機(jī)可以將代碼實(shí)時(shí)編譯或者預(yù)先編譯到原生代碼。對(duì)于那些沒(méi)有列出來(lái)的系統(tǒng),則使用的是代碼解釋器。
這部分內(nèi)容摘自:http://www.mono-project.com/docs/about-mono/
mono - C# Compiler
Mono’s C# compiler is feature complete for C# 1.0, 2.0, 3.0, 4.0 and 5.0 (ECMA). A good description of the feature of the various versions is available on?Wikipedia.
mono的c#編譯器提供c# 1.0,2.0,3.0,4.0和5.0(ECMA)完整的功能。不同版本的特性的描述可以在維基百科上查看。
mono - Mono Runtime
The runtime implements the ECMA Common Language Infrastructure (CLI). The runtime provides a Just-in-Time (JIT) compiler, an Ahead-of-Time compiler (AOT), a library loader, the garbage collector, a threading system and interoperability functionality.
mono運(yùn)行時(shí)實(shí)現(xiàn)了ECMA 公共語(yǔ)言基礎(chǔ)(CLI)。運(yùn)行時(shí)提供了即時(shí)(JIT)編譯器,提前的編譯器(AOT),庫(kù)加載器,垃圾回收機(jī)器,線程操作,互操作性
mono - .NET Frame Class Libray
The Mono platform provides a comprehensive set of classes that provide a solid foundation to build applications on. These classes are compatible with Microsoft’s .Net Framework classes.
Mono平臺(tái)提供了一組全面的類(lèi)來(lái)構(gòu)建應(yīng)用程序提供一個(gè)堅(jiān)實(shí)的基礎(chǔ)。這些類(lèi)是兼容微軟的.Net framework
mono - Mono Class Libray
Mono also provides many classes that go above and beyond the Base Class Library provided by Microsoft. These provide additional functionality that are useful, especially in building Linux applications. Some examples are classes for Gtk+, Zip files, LDAP, OpenGL, Cairo, POSIX, etc.
Mono還提供了很多類(lèi),甚至超越了微軟提供的基類(lèi)庫(kù)。這些提供額外的功能是有用的,特別是在構(gòu)建Linux應(yīng)用程序。一些例子是Gtk +,Zip文件、LDAP、OpenGL,Cairo,POSIX等等。
.Net和Mono
.Net和C#版本
.Net版本和C#版本:http://www.cnblogs.com/zhaoqingqing/p/5478239.html
| .net 3.5 | 3.0 | vs2008 | 2007-08 |
| .net 4.0 | 4.0 | vs2010 | 2010-04 |
| .net 4.5 | 5.0 | vs2012/13 | 2012-10 |
| .net 4.6 | 6.0 | vs2015 | 2015-07 |
.Net和Mono版本關(guān)系
一個(gè)大致的版本對(duì)應(yīng)關(guān)系
| 2008-10-01 | mono 2.0 | .net 2.0 c# 3.0 | |
| 2011-12-19 | mono 2.10.8 | .net 4.0 c# 4.0 | |
| 2014-03-31 | mono 3.4 | .net 4.5 c#5.0 | |
| 2016-06-08 | mono 4.4.0 | .net 4.6.1 c#6.0 |
mono編譯器版本升級(jí)?mono運(yùn)行庫(kù)沒(méi)有升級(jí),目前運(yùn)行時(shí)的mono還是?3.5
Mono發(fā)行版本
| 2004-06-30 | 1.0 | C# 1.0 support |
| 2006-11-09 | 1.2 | C# 2.0 support |
| 2008-10-06 | 2.0 | .Net 2.0 C# 3.0 |
| 2010-09-22 | 2.8 | .Net profile C#4.0 support |
| 2012-10-15 | 3.0 | C# 5.0 support,async base class libray,MVC4 partial |
| 2014-03-31 | 3.4 | |
| 2015-04-29 | 4.0 | .NET 4.5 profile .NET4.5 assembiles,C#6.0,integrate .net core code |
| 2014-03-31 | 4.2 | |
| 2016-06-08 | 4.4 | |
| 2016-08-01 | 4.6 |
2016 Mono joins the .NET Foundation
參考資料
Mono release:?http://www.mono-project.com/docs/about-mono/releases/
Mono 4.4:http://www.mono-project.com/docs/about-mono/releases/4.4.0/
Mono software:?https://en.wikipedia.org/wiki/Mono_(software)
Unity3D發(fā)行版本
| 3.5 | ||
| 4.0 | 引擎大版本升級(jí) | |
| 4.3 | 新的2D工具,Sprite | |
| 4.6 | uGUI,IL2CPP | |
| 5.0 | 2.0/2.0 | shader,assetbundle重大改變 ,等等 |
| 5.3.5p8 | 2.0/4.4 | Mono編譯器升級(jí)運(yùn)行時(shí)未升級(jí),等等 |
| 5.4.0 f1 | 2.0/2.0 | 更多VR平臺(tái)支持,等等 |
擴(kuò)展資料
http://blogs.unity3d.com/2016/04/01/unity-joins-the-net-foundation/
更多信息
我的疑問(wèn)
編譯器和運(yùn)行時(shí)版本不匹配可以正常執(zhí)行?
文獻(xiàn)資料
mono project github:?https://github.com/mono/mono
mono doc:?http://www.mono-project.com/docs/
Mono英文百科:[https://en.wikipedia.org/wiki/Mono](https://en.wikipedia.org/wiki/Mono)
Mono中文百科:https://zh.wikipedia.org/wiki/Mono
擴(kuò)展資料
[.NET Core與.NET Framework、Mono之間的關(guān)系](http://www.cnblogs.com/shanyou/p/4295163.html)
魅力 .NET:從 Mono、.NET Core 說(shuō)起
[c#基礎(chǔ)系列二]:從編譯,執(zhí)行過(guò)程理解c#
Mono為何能跨平臺(tái)?聊聊CIL(MSIL)
國(guó)內(nèi) Mono 相關(guān)文章匯總:http://www.cnblogs.com/shanyou/archive/2012/07/28/2612919.html
原文地址:http://www.cnblogs.com/zhaoqingqing/p/5762867.html
.NET社區(qū)新聞,深度好文,微信中搜索dotNET跨平臺(tái)或掃描二維碼關(guān)注
總結(jié)
以上是生活随笔為你收集整理的从Unity3D编译器升级聊起Mono的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 介绍开源的.net通信框架Network
- 下一篇: F#年度调查结果概述