diff --git a/Source/Bind/FuncProcessor.cs b/Source/Bind/FuncProcessor.cs index 9526fc0a..a5e8683f 100644 --- a/Source/Bind/FuncProcessor.cs +++ b/Source/Bind/FuncProcessor.cs @@ -129,11 +129,27 @@ namespace Bind Console.WriteLine("Removing overloaded delegates."); RemoveOverloadedDelegates(delegates, wrappers); + Console.WriteLine("Generating address table."); + GenerateAddressTable(delegates); + return wrappers; } #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 // all generated wrappers use the first (original) delegate, not // the overloaded ones. This allows us to reduce the amount diff --git a/Source/Bind/Structures/Delegate.cs b/Source/Bind/Structures/Delegate.cs index 2596be87..5c87bfad 100644 --- a/Source/Bind/Structures/Delegate.cs +++ b/Source/Bind/Structures/Delegate.cs @@ -53,6 +53,7 @@ namespace Bind.Structures DeprecatedVersion = d.DeprecatedVersion; EntryPoint = d.EntryPoint; Obsolete = d.Obsolete; + Slot = d.Slot; } #endregion @@ -242,6 +243,9 @@ namespace Bind.Structures public string EntryPoint { get; set; } public string Obsolete { get; set; } + // Slot index in the address table + public int Slot { get; set; } + #endregion // This method should only be used for debugging purposes, not for code generation!