Browse Source

Reworked per-Abi vtable code to correctly handle all platforms.

pull/552/merge
triton 11 years ago
parent
commit
89cdf8b997
  1. 20
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

20
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -1397,16 +1397,10 @@ namespace CppSharp.Generators.CSharp
WriteLine("if (__ManagedVTables == null)"); WriteLine("if (__ManagedVTables == null)");
WriteStartBraceIndent(); WriteStartBraceIndent();
switch (Driver.Options.Abi) if (Options.IsMicrosoftAbi)
{
case CppAbi.Microsoft:
AllocateNewVTablesMS(@class, entries, wrappedEntries); AllocateNewVTablesMS(@class, entries, wrappedEntries);
break; else
case CppAbi.Itanium:
case CppAbi.ARM:
AllocateNewVTablesItanium(@class, entries, wrappedEntries); AllocateNewVTablesItanium(@class, entries, wrappedEntries);
break;
}
WriteCloseBraceIndent(); WriteCloseBraceIndent();
NewLine(); NewLine();
@ -1663,9 +1657,8 @@ namespace CppSharp.Generators.CSharp
public void GenerateVTablePointers(Class @class) public void GenerateVTablePointers(Class @class)
{ {
switch (Driver.Options.Abi) if (Options.IsMicrosoftAbi)
{ {
case CppAbi.Microsoft:
var index = 0; var index = 0;
foreach (var info in @class.Layout.VFTables) foreach (var info in @class.Layout.VFTables)
{ {
@ -1676,16 +1669,15 @@ namespace CppSharp.Generators.CSharp
PopBlock(NewLineKind.BeforeNextBlock); PopBlock(NewLineKind.BeforeNextBlock);
} }
break; }
case CppAbi.Itanium: else
case CppAbi.ARM: {
PushBlock(CSharpBlockKind.InternalsClassField); PushBlock(CSharpBlockKind.InternalsClassField);
WriteLine("[FieldOffset(0)]"); WriteLine("[FieldOffset(0)]");
WriteLine("public global::System.IntPtr vfptr0;"); WriteLine("public global::System.IntPtr vfptr0;");
PopBlock(NewLineKind.BeforeNextBlock); PopBlock(NewLineKind.BeforeNextBlock);
break;
} }
} }

Loading…
Cancel
Save