Browse Source

Fixed the generated C# when returning a non-const char*.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1166/head
Dimitar Dobrev 6 years ago
parent
commit
e2a23b8987
  1. 3
      src/AST/Type.cs
  2. 2
      tests/CSharp/CSharp.Tests.cs
  3. 9
      tests/CSharp/CSharp.cpp
  4. 3
      tests/CSharp/CSharp.h

3
src/AST/Type.cs

@ -447,7 +447,8 @@ namespace CppSharp.AST @@ -447,7 +447,8 @@ namespace CppSharp.AST
return Declaration.Type.Equals(typedef == null ? obj : typedef.Declaration.Type);
}
public override int GetHashCode() => Declaration.Type.GetHashCode();
public override int GetHashCode() =>
Declaration.OriginalName.GetHashCode() ^ Declaration.Type.GetHashCode();
}
/// <summary>

2
tests/CSharp/CSharp.Tests.cs

@ -94,6 +94,8 @@ public unsafe class CSharpTests : GeneratorTestFixture @@ -94,6 +94,8 @@ public unsafe class CSharpTests : GeneratorTestFixture
{
}
CSharp.CSharp.ReturnCharPointer();
#pragma warning restore 0168
#pragma warning restore 0219
}

9
tests/CSharp/CSharp.cpp

@ -1542,3 +1542,12 @@ void InterfaceTester::setInterface(SimpleInterface* i) @@ -1542,3 +1542,12 @@ void InterfaceTester::setInterface(SimpleInterface* i)
{
interface = i;
}
void va_listFunction(va_list v)
{
}
char* returnCharPointer()
{
return 0;
}

3
tests/CSharp/CSharp.h

@ -1298,3 +1298,6 @@ public: @@ -1298,3 +1298,6 @@ public:
private:
SimpleInterface* interface;
};
DLL_API void va_listFunction(va_list v);
DLL_API char* returnCharPointer();

Loading…
Cancel
Save