diff --git a/ikvmc/Compiler.cs b/ikvmc/Compiler.cs index 5795c70e..bc779b70 100644 --- a/ikvmc/Compiler.cs +++ b/ikvmc/Compiler.cs @@ -50,7 +50,7 @@ class IkvmcCompiler private Dictionary resources = new Dictionary(); private string defaultAssemblyName; private List classesToExclude = new List(); - private List references = new List(); + private List references = new List(); private static bool time; private static List GetArgs(string[] args) @@ -242,7 +242,7 @@ class IkvmcCompiler nestedLevel.resources = new Dictionary(resources); nestedLevel.defaultAssemblyName = defaultAssemblyName; nestedLevel.classesToExclude = new List(classesToExclude); - nestedLevel.references = new List(references); + nestedLevel.references = new List(references); int rc = nestedLevel.ContinueParseCommandLine(arglist, targets, options.Copy()); if(rc != 0) { @@ -422,11 +422,22 @@ class IkvmcCompiler Console.Error.WriteLine("Error: reference not found: {0}", r); return 1; } - files = new string[] { asm.Location }; + references.Add(asm); } - foreach(string f in files) + else { - references.Add(f); + foreach(string file in files) + { + try + { + references.Add(Assembly.LoadFile(file)); + } + catch(FileLoadException) + { + Console.Error.WriteLine("Error: reference not found: {0}", file); + return 1; + } + } } } else if(s.StartsWith("-recurse:")) diff --git a/ikvmc/CompilerClassLoader.cs b/ikvmc/CompilerClassLoader.cs index 9a0a5066..66634cd7 100644 --- a/ikvmc/CompilerClassLoader.cs +++ b/ikvmc/CompilerClassLoader.cs @@ -746,7 +746,7 @@ namespace IKVM.Internal this.classLoader = classLoader; classDef = c; bool baseIsSealed = false; - shadowType = Type.GetType(c.Shadows, true); + shadowType = JVM.GetType(c.Shadows, true); classLoader.SetRemappedType(shadowType, this); Type baseType = shadowType; Type baseInterface = null; @@ -2523,20 +2523,14 @@ namespace IKVM.Internal AssemblyName runtimeAssemblyName = StaticCompiler.runtimeAssembly.GetName(); bool allReferencesAreStrongNamed = IsSigned(StaticCompiler.runtimeAssembly); List references = new List(); - foreach(string r in options.references) + foreach(Assembly reference in options.references) { try { - Assembly reference = LoadReferencedAssembly(r); if(IsCoreAssembly(reference)) { JVM.CoreAssembly = reference; } - if(reference == null) - { - Console.Error.WriteLine("Error: reference not found: {0}", r); - return 1; - } references.Add(reference); allReferencesAreStrongNamed &= IsSigned(reference); Tracer.Info(Tracer.Compiler, "Loaded reference assembly: {0}", reference.FullName); @@ -2550,7 +2544,7 @@ namespace IKVM.Internal { if(asmref.FullName != runtimeAssemblyName.FullName) { - Console.Error.WriteLine("Error: referenced assembly {0} was compiled with an incompatible IKVM.Runtime version ({1})", r, asmref.Version); + Console.Error.WriteLine("Error: referenced assembly {0} was compiled with an incompatible IKVM.Runtime version ({1})", reference.Location, asmref.Version); Console.Error.WriteLine(" Current runtime: {0}", runtimeAssemblyName.FullName); Console.Error.WriteLine(" Referenced assembly runtime: {0}", asmref.FullName); return 1; @@ -2560,7 +2554,7 @@ namespace IKVM.Internal { if(asmref.GetPublicKeyToken() != null && asmref.GetPublicKeyToken().Length != 0) { - Console.Error.WriteLine("Error: referenced assembly {0} was compiled with an incompatible (signed) IKVM.Runtime version", r); + Console.Error.WriteLine("Error: referenced assembly {0} was compiled with an incompatible (signed) IKVM.Runtime version", reference.Location); Console.Error.WriteLine(" Current runtime: {0}", runtimeAssemblyName.FullName); Console.Error.WriteLine(" Referenced assembly runtime: {0}", asmref.FullName); return 1; @@ -2571,7 +2565,7 @@ namespace IKVM.Internal } catch(Exception x) { - Console.Error.WriteLine("Error: invalid reference: {0} ({1})", r, x.Message); + Console.Error.WriteLine("Error: invalid reference: {0} ({1})", reference.Location, x.Message); return 1; } } @@ -3078,7 +3072,7 @@ namespace IKVM.Internal internal PEFileKinds target; internal bool guessFileKind; internal Dictionary classes; - internal string[] references; + internal Assembly[] references; internal Dictionary resources; internal string[] classesToExclude; internal string remapfile;