Regarding my former article now I’d like to give you a continued HowTo for tapping the Mono C# compiler with support for generics, nullable types and friend assemblies. Compared to the mcs tool (.NET 1.1 target runtime) you have to compile the gmcs fork (.NET 2.0 target runtime) of the mono compiler project.
As shown in my previous post first of all you must run the jay parser generator. But now please use the cs-parser.jay input file in the gmcs directory. Again jay will create the output file cs-parser.cs.
In the first step create a new Visual Studio solution and choose C# Class Library as project type. Afterwards add all *.cs files of the following directories to your project:
+ MONO-SRC\mcs\mcs
+ MONO-SRC\mcs\gmcs
Preferably you can put the whole mono stuff in a subdirectory of your solution and import the files listed above as links. Don’t forget to exclude the following two files because they are already present:
- MONO-SRC\mcs\mcs\AssemblyInfo.cs
- MONO-SRC\mcs\mcs\generics.cs
Finally please also add all files of …
+ MONO-SRC\class\Mono.CompilerServices.SymbolWriter
… as soon as the CryptoConvert.cs file of:
+ MONO-SRC\class\Mono.Security.Cryptography
In the second step define the following three Conditional Compilation Symbols in your Project Properties via the Build pane:
GMCS_SOURCE
MS_COMPATIBLE
NET_2_0
From now on you can compile gmcs. Well, there still exists a few warnings but I think you can ignore that till anytime gmcs becomes the default mono compiler