Пример #1
0
        internal ModuleBuilder(AssemblyBuilder assb, string name, string fullyqname, bool emitSymbolInfo, bool transient)
        {
            this.name      = this.scopename = name;
            this.fqname    = fullyqname;
            this.assembly  = this.assemblyb = assb;
            this.transient = transient;
            // to keep mcs fast we do not want CryptoConfig wo be involved to create the RNG
            guid = Guid.FastNewGuidArray();
            // guid = Guid.NewGuid().ToByteArray ();
            table_idx  = get_next_table_index(this, 0x00, true);
            name_cache = new Hashtable();

            basic_init(this);

            CreateGlobalType();

            if (emitSymbolInfo)
            {
                Assembly asm = Assembly.LoadWithPartialName("Mono.CompilerServices.SymbolWriter");
                Type     t   = asm.GetType("Mono.CompilerServices.SymbolWriter.SymbolWriterImpl");
                if (t != null)
                {
                    symbolWriter = (ISymbolWriter)Activator.CreateInstance(t, new object[] { this });
                    string fileName = fqname;
                    if (assemblyb.AssemblyDir != null)
                    {
                        fileName = Path.Combine(assemblyb.AssemblyDir, fileName);
                    }
                    symbolWriter.Initialize(IntPtr.Zero, fileName, true);
                }
            }
        }
Пример #2
0
        internal ModuleBuilder(AssemblyBuilder assb, string name, string fullyqname, bool emitSymbolInfo, bool transient)
        {
            this.name      = this.scopename = name;
            this.fqname    = fullyqname;
            this.assembly  = this.assemblyb = assb;
            this.transient = transient;
            // to keep mcs fast we do not want CryptoConfig wo be involved to create the RNG
            guid = Guid.FastNewGuidArray();
            // guid = Guid.NewGuid().ToByteArray ();
            table_idx       = get_next_table_index(this, 0x00, true);
            name_cache      = new Hashtable();
            us_string_cache = new Dictionary <string, int> (512);

            basic_init(this);

            CreateGlobalType();

            if (assb.IsRun)
            {
                TypeBuilder tb   = new TypeBuilder(this, TypeAttributes.Abstract, 0xFFFFFF);                /*last valid token*/
                Type        type = tb.CreateType();
                set_wrappers_type(this, type);
            }

            if (emitSymbolInfo)
            {
#if MOONLIGHT
                symbolWriter = new Mono.CompilerServices.SymbolWriter.SymbolWriterImpl(this);
#else
                Assembly asm = Assembly.LoadWithPartialName("Mono.CompilerServices.SymbolWriter");
                if (asm == null)
                {
                    throw new ExecutionEngineException("The assembly for default symbol writer cannot be loaded");
                }

                Type t = asm.GetType("Mono.CompilerServices.SymbolWriter.SymbolWriterImpl");
                if (t == null)
                {
                    throw new ExecutionEngineException("The type that implements the default symbol writer interface cannot be found");
                }

                symbolWriter = (ISymbolWriter)Activator.CreateInstance(t, new object[] { this });
#endif
                string fileName = fqname;
                if (assemblyb.AssemblyDir != null)
                {
                    fileName = Path.Combine(assemblyb.AssemblyDir, fileName);
                }
                symbolWriter.Initialize(IntPtr.Zero, fileName, true);
            }
        }
Пример #3
0
		internal ModuleBuilder (AssemblyBuilder assb, string name, string fullyqname, bool emitSymbolInfo, bool transient) {
			this.name = this.scopename = name;
			this.fqname = fullyqname;
			this.assembly = this.assemblyb = assb;
			this.transient = transient;
			// to keep mcs fast we do not want CryptoConfig wo be involved to create the RNG
			guid = Guid.FastNewGuidArray ();
			// guid = Guid.NewGuid().ToByteArray ();
			table_idx = get_next_table_index (this, 0x00, true);
			name_cache = new Hashtable ();
			us_string_cache = new Dictionary<string, int> (512);

			basic_init (this);

			CreateGlobalType ();

			if (assb.IsRun) {
				TypeBuilder tb = new TypeBuilder (this, TypeAttributes.Abstract, 0xFFFFFF); /*last valid token*/
				Type type = tb.CreateType ();
				set_wrappers_type (this, type);
			}

			if (emitSymbolInfo) {
#if MOONLIGHT
				symbolWriter = new Mono.CompilerServices.SymbolWriter.SymbolWriterImpl (this);
#else
				Assembly asm = Assembly.LoadWithPartialName ("Mono.CompilerServices.SymbolWriter");
				if (asm == null)
					throw new TypeLoadException ("The assembly for default symbol writer cannot be loaded");

				Type t = asm.GetType ("Mono.CompilerServices.SymbolWriter.SymbolWriterImpl", true);
				symbolWriter = (ISymbolWriter) Activator.CreateInstance (t, new object[] { this });
#endif
				string fileName = fqname;
				if (assemblyb.AssemblyDir != null)
					fileName = Path.Combine (assemblyb.AssemblyDir, fileName);
				symbolWriter.Initialize (IntPtr.Zero, fileName, true);
			}
		}