blob: d7460d45acc3c780592bc8bedce9387961de3c36 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Internal.TypeSystem.Ecma;
using Internal.TypeSystem;
using Internal.IL.Stubs.StartupCode;
namespace ILCompiler
{
/// <summary>
/// Provides compilation group for a native library that compiles the initialize method.
/// </summary>
public class NativeLibraryInitializerRootProvider : ICompilationRootProvider
{
/// <summary>
/// Symbolic name under which the managed initializer is exported.
/// </summary>
public const string ManagedEntryPointMethodName = "__managed__Startup";
private EcmaModule _module;
private IList<MethodDesc> _libraryInitializers;
public NativeLibraryInitializerRootProvider(EcmaModule module, IList<MethodDesc> libraryInitializers)
{
_module = module;
_libraryInitializers = libraryInitializers;
}
public void AddCompilationRoots(IRootingServiceProvider rootProvider)
{
TypeDesc owningType = _module.GetGlobalModuleType();
NativeLibraryStartupMethod nativeLibStartupCode = new NativeLibraryStartupMethod(owningType, _libraryInitializers);
rootProvider.AddCompilationRoot(nativeLibStartupCode, "Startup Code Main Method", ManagedEntryPointMethodName);
}
}
}
|