Example #1
0
        public void Save()
        {
            PortableExecutableKinds pekind;
            ImageFileMachine        machine;

            switch (Compiler.Settings.Platform)
            {
            case Platform.X86:
                pekind  = PortableExecutableKinds.Required32Bit | PortableExecutableKinds.ILOnly;
                machine = ImageFileMachine.I386;
                break;

            case Platform.X64:
                pekind  = PortableExecutableKinds.ILOnly;
                machine = ImageFileMachine.AMD64;
                break;

            case Platform.IA64:
                pekind  = PortableExecutableKinds.ILOnly;
                machine = ImageFileMachine.IA64;
                break;

            case Platform.AnyCPU:
            default:
                pekind  = PortableExecutableKinds.ILOnly;
                machine = ImageFileMachine.I386;
                break;
            }

            Compiler.TimeReporter.Start(TimeReporter.TimerType.OutputSave);
            try
            {
                if (Compiler.Settings.Target == Target.Module)
                {
                    SaveModule(pekind, machine);
                }
                else
                {
                    // TODO: Fix stuff
#if NETFRAMEWORK
                    Builder.Save(module.Builder.ScopeName, pekind, machine);
#endif
                }
            }
            catch (Exception e)
            {
                Report.Error(16, "Could not write to file `" + name + "', cause: " + e.Message);
            }
            Compiler.TimeReporter.Stop(TimeReporter.TimerType.OutputSave);

            // Save debug symbols file
            if (symbol_writer != null)
            {
                // TODO: it should run in parallel
                Compiler.TimeReporter.Start(TimeReporter.TimerType.DebugSave);
                symbol_writer.WriteSymbolFile(SymbolWriter.GetGuid(module.Builder));
                Compiler.TimeReporter.Stop(TimeReporter.TimerType.DebugSave);
            }
        }
Example #2
0
        public void Save()
        {
            PortableExecutableKinds pekind;
            ImageFileMachine        machine;

            switch (RootContext.Platform)
            {
            case Platform.X86:
                pekind  = PortableExecutableKinds.Required32Bit | PortableExecutableKinds.ILOnly;
                machine = ImageFileMachine.I386;
                break;

            case Platform.X64:
                pekind  = PortableExecutableKinds.ILOnly;
                machine = ImageFileMachine.AMD64;
                break;

            case Platform.IA64:
                pekind  = PortableExecutableKinds.ILOnly;
                machine = ImageFileMachine.IA64;
                break;

            case Platform.AnyCPU:
            default:
                pekind  = PortableExecutableKinds.ILOnly;
                machine = ImageFileMachine.I386;
                break;
            }

            try
            {
                if (RootContext.Target == Target.Module)
                {
                    SaveModule(pekind, machine);
                }
                else
                {
                    Builder.Save(module.Builder.ScopeName, pekind, machine);
                }
            }
            catch (Exception e)
            {
                Report.Error(16, "Could not write to file `" + name + "', cause: " + e.Message);
            }

            // Save debug symbols file
            if (symbol_writer != null)
            {
                // TODO: it should run in parallel
                symbol_writer.WriteSymbolFile(SymbolWriter.GetGuid(module.Builder));
            }
        }