Browse Source

V-table method delegates need to take into account same-named overloads.

Fixes #88.
pull/92/head
triton 12 years ago
parent
commit
44ce759a33
  1. 8
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs
  2. 10
      tests/VTables/VTables.cpp
  3. 3
      tests/VTables/VTables.h

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

@ -1370,8 +1370,12 @@ namespace CppSharp.Generators.CSharp @@ -1370,8 +1370,12 @@ namespace CppSharp.Generators.CSharp
public string GetVTableMethodDelegateName(Method method)
{
// trim '@' (if any) because '@' is valid only as the first symbol
return string.Format("_{0}Delegate", GetFunctionIdentifier(method).Trim('@'));
var nativeId = GetFunctionNativeIdentifier(method);
// Trim '@' (if any) because '@' is valid only as the first symbol.
nativeId = nativeId.Trim('@');
return string.Format("_{0}Delegate", nativeId);
}
public void GenerateVTablePointers(Class @class)

10
tests/VTables/VTables.cpp

@ -14,6 +14,16 @@ int Foo::vbar() @@ -14,6 +14,16 @@ int Foo::vbar()
return 3;
}
int Foo::append()
{
return 1;
}
int Foo::append(int a)
{
return ++a;
}
int FooCallFoo(Foo* foo)
{
return foo->vfoo() + 2;

3
tests/VTables/VTables.h

@ -15,6 +15,9 @@ public: @@ -15,6 +15,9 @@ public:
Foo();
virtual int vfoo();
virtual int vbar();
virtual int append();
virtual int append(int a);
};
DLL_API int FooCallFoo(Foo* foo);

Loading…
Cancel
Save