" --about About the Mono C# compiler\n" +
" -addmodule:M1[,Mn] Adds the module to the generated assembly\n" +
" -checked[+|-] Sets default aritmetic overflow context\n" +
- " -codepage:ID Sets code page to the one in ID (number, utf8, reset)\n" +
" -clscheck[+|-] Disables CLS Compliance verifications\n" +
+ " -codepage:ID Sets code page to the one in ID (number, utf8, reset)\n" +
" -define:S1[;S2] Defines one or more conditional symbols (short: -d)\n" +
" -debug[+|-], -g Generate debugging information\n" +
" -delaysign[+|-] Only insert the public key into the assembly (no signing)\n" +
" -nowarn:W1[,Wn] Suppress one or more compiler warnings\n" +
" -optimize[+|-] Enables advanced compiler optimizations (short: -o)\n" +
" -out:FILE Specifies output assembly name\n" +
-#if !SMCS_SOURCE
" -pkg:P1[,Pn] References packages P1..Pn\n" +
-#endif
" -platform:ARCH Specifies the target platform of the output assembly\n" +
" ARCH can be one of: anycpu, x86, x64 or itanium\n" +
" -recurse:SPEC Recursively compiles files according to SPEC pattern\n" +
" -reference:A1[,An] Imports metadata from the specified assembly (short: -r)\n" +
- " -reference:ALIAS=A Imports metadata using specified extern alias (short: -r)\n" +
+ " -reference:ALIAS=A Imports metadata using specified extern alias (short: -r)\n" +
+ " -sdk:VERSION Specifies SDK version of referenced assemlies\n" +
+ " VERSION can be one of: 2 (default), 4\n" +
" -target:KIND Specifies the format of the output assembly (short: -t)\n" +
" KIND can be one of: exe, winexe, library, module\n" +
" -unsafe[+|-] Allows to compile code which uses unsafe keyword\n" +
return false;
}
-#if !SMCS_SOURCE
public static string GetPackageFlags (string packages, bool fatal, Report report)
{
ProcessStartInfo pi = new ProcessStartInfo ();
return pkgout;
}
-#endif
//
// This parses the -arg and /arg options to the compiler, even if the strings
//
Console.WriteLine ("To file bug reports, please visit: http://www.mono-project.com/Bugs");
return true;
-#if !SMCS_SOURCE
+
case "/pkg": {
string packages;
return true;
}
-#endif
+
case "/linkres":
case "/linkresource":
case "/res":
return true;
+ case "/sdk":
+ if (value.Length == 0) {
+ Error_RequiresArgument (option);
+ break;
+ }
+
+ switch (value.ToLowerInvariant ()) {
+ case "2":
+ RootContext.SdkVersion = SdkVersion.v2;
+ break;
+ case "4":
+ RootContext.SdkVersion = SdkVersion.v4;
+ break;
+ default:
+ Report.Error (-26, "Invalid sdk version name");
+ break;
+ }
+
+ return true;
+
// We just ignore this.
case "/errorreport":
case "/filealign":
stopwatch = Stopwatch.StartNew ();
#if STATIC
- var assembly = new AssemblyDefinitionStatic (module, output_file_name, output_file);
- module.SetDeclaringAssembly (assembly);
-
var importer = new StaticImporter ();
- assembly.Importer = importer;
+ var references_loader = new StaticLoader (importer, ctx);
- var loader = new StaticLoader (importer, ctx);
- loader.LoadReferences (module);
+ var assembly = new AssemblyDefinitionStatic (module, references_loader, output_file_name, output_file);
+ assembly.Create (references_loader.Domain);
+ // Create compiler types first even before any referenced
+ // assembly is loaded to allow forward referenced types from
+ // loaded assembly into compiled builder to be resolved
+ // correctly
+ module.CreateType ();
+ ShowTime ("Creating compiled types");
+
+ importer.AddCompiledAssembly (assembly);
+ references_loader.LoadReferences (module);
ShowTime ("Imporing referenced assemblies");
if (!ctx.BuildinTypes.CheckDefinitions (module))
ShowTime ("Initializing predefined types");
- if (!assembly.Create (loader))
- return false;
-
- // System.Object was not loaded, use compiled assembly as corlib
- if (loader.Corlib == null)
- loader.Corlib = assembly.Builder;
-
- loader.LoadModules (assembly, module.GlobalRootNamespace);
+ references_loader.LoadModules (assembly, module.GlobalRootNamespace);
#else
var assembly = new AssemblyDefinitionDynamic (module, output_file_name, output_file);
module.SetDeclaringAssembly (assembly);
assembly.Save ();
#if STATIC
- loader.Dispose ();
+ references_loader.Dispose ();
#endif
ShowTime ("Saving output assembly");