Add slots into entry point table

This commit is contained in:
Stefanos A. 2013-11-24 13:55:13 +01:00
parent 7b93a87bb0
commit 2045f3e98e
2 changed files with 20 additions and 0 deletions

View file

@ -129,11 +129,27 @@ namespace Bind
Console.WriteLine("Removing overloaded delegates."); Console.WriteLine("Removing overloaded delegates.");
RemoveOverloadedDelegates(delegates, wrappers); RemoveOverloadedDelegates(delegates, wrappers);
Console.WriteLine("Generating address table.");
GenerateAddressTable(delegates);
return wrappers; return wrappers;
} }
#region Private Members #region Private Members
static void GenerateAddressTable(DelegateCollection delegates)
{
int slot = -1;
foreach (var list in delegates.Values)
{
slot++;
foreach (var d in list)
{
d.Slot = slot;
}
}
}
// When we have a list of overloaded delegates, make sure that // When we have a list of overloaded delegates, make sure that
// all generated wrappers use the first (original) delegate, not // all generated wrappers use the first (original) delegate, not
// the overloaded ones. This allows us to reduce the amount // the overloaded ones. This allows us to reduce the amount

View file

@ -53,6 +53,7 @@ namespace Bind.Structures
DeprecatedVersion = d.DeprecatedVersion; DeprecatedVersion = d.DeprecatedVersion;
EntryPoint = d.EntryPoint; EntryPoint = d.EntryPoint;
Obsolete = d.Obsolete; Obsolete = d.Obsolete;
Slot = d.Slot;
} }
#endregion #endregion
@ -242,6 +243,9 @@ namespace Bind.Structures
public string EntryPoint { get; set; } public string EntryPoint { get; set; }
public string Obsolete { get; set; } public string Obsolete { get; set; }
// Slot index in the address table
public int Slot { get; set; }
#endregion #endregion
// This method should only be used for debugging purposes, not for code generation! // This method should only be used for debugging purposes, not for code generation!