private static void LoadSharedClassLoaderAssemblies(Assembly assembly, List <Assembly> assemblies) { if (assembly.GetManifestResourceInfo("ikvm.exports") != null) { using (Stream stream = assembly.GetManifestResourceStream("ikvm.exports")) { BinaryReader rdr = new BinaryReader(stream); int assemblyCount = rdr.ReadInt32(); for (int i = 0; i < assemblyCount; i++) { string name = rdr.ReadString(); int typeCount = rdr.ReadInt32(); if (typeCount > 0) { for (int j = 0; j < typeCount; j++) { rdr.ReadInt32(); } try { assemblies.Add(StaticCompiler.Load(name)); } catch { Console.WriteLine("Warning: Unable to load shared class loader assembly: {0}", name); } } } } } }
private Assembly LoadAssemblyOrClearName(ref string name, bool exported) { if (name == null) { // previous load attemp failed return(null); } try { #if STATIC_COMPILER || STUB_GENERATOR if (exported) { return(StaticCompiler.LoadFile(this.MainAssembly.Location + "/../" + new AssemblyName(name).Name + ".dll")); } else { return(StaticCompiler.Load(name)); } #else return(Assembly.Load(name)); #endif } catch { // cache failure by clearing out the name the caller uses name = null; // should we issue a warning error (in ikvmc)? return(null); } }
internal static ClassLoaderWrapper GetAssemblyClassLoaderByName(string name) { if (name.StartsWith("[[")) { return(GetGenericClassLoaderByName(name)); } #if STATIC_COMPILER || STUB_GENERATOR return(AssemblyClassLoader.FromAssembly(StaticCompiler.Load(name))); #else return(AssemblyClassLoader.FromAssembly(Assembly.Load(name))); #endif }