Beispiel #1
0
        public void AddCompilationRoots(IRootingServiceProvider rootProvider)
        {
            MethodDesc mainMethod = _module.EntryPoint;

            if (mainMethod == null)
            {
                throw new Exception("No managed entrypoint defined for executable module");
            }

            TypeDesc owningType      = _module.GetGlobalModuleType();
            var      startupCodeMain = new StartupCodeMainMethod(owningType, mainMethod, _libraryInitializers);

            rootProvider.AddCompilationRoot(startupCodeMain, "Startup Code Main Method", ManagedEntryPointMethodName);
        }
Beispiel #2
0
        private void AddMainMethodCompilationRoot(EcmaModule module)
        {
            if (StartupCodeMain != null)
            {
                throw new Exception("Multiple entrypoint modules");
            }

            int        entryPointToken = module.PEReader.PEHeaders.CorHeader.EntryPointTokenOrRelativeVirtualAddress;
            MethodDesc mainMethod      = module.GetMethod(MetadataTokens.EntityHandle(entryPointToken));

            var owningType = module.GetGlobalModuleType();

            StartupCodeMain = new StartupCodeMainMethod(owningType, mainMethod);

            _rootProvider.AddCompilationRoot(StartupCodeMain, "Startup Code Main Method", "__managed__Main");
        }
Beispiel #3
0
        private void AddMainMethodCompilationRoot(EcmaModule module, IRootingServiceProvider rootProvider)
        {
            if (StartupCodeMain != null)
            {
                throw new Exception("Multiple entrypoint modules");
            }

            MethodDesc mainMethod = module.EntryPoint;

            if (mainMethod == null)
            {
                throw new Exception("No managed entrypoint defined for executable module");
            }

            var owningType = module.GetGlobalModuleType();

            StartupCodeMain = new StartupCodeMainMethod(owningType, mainMethod);

            rootProvider.AddCompilationRoot(StartupCodeMain, "Startup Code Main Method", "__managed__Main");
        }