Browse Source

Fixed the generated C# when a virtual function returns a primitive pointer.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/696/head
Dimitar Dobrev 9 years ago
parent
commit
3ee6165053
  1. 3
      src/Generator/Generators/CSharp/CSharpMarshal.cs
  2. 2
      tests/Common/Common.h

3
src/Generator/Generators/CSharp/CSharpMarshal.cs

@ -494,7 +494,8 @@ namespace CppSharp.Generators.CSharp @@ -494,7 +494,8 @@ namespace CppSharp.Generators.CSharp
if (!VisitType(pointer, quals))
return false;
if (Context.Function != null && pointer.IsPrimitiveTypeConvertibleToRef())
if (Context.Function != null && pointer.IsPrimitiveTypeConvertibleToRef() &&
Context.Kind != CSharpMarshalKind.VTableReturnValue)
{
var refParamPtr = string.Format("__refParamPtr{0}", Context.ParameterIndex);
Context.SupportBefore.WriteLine("fixed ({0} {1} = &{2})",

2
tests/Common/Common.h

@ -36,7 +36,7 @@ public: @@ -36,7 +36,7 @@ public:
class NestedAbstract
{
public:
virtual void abstractFunctionInNestedClass() = 0;
virtual int* abstractFunctionInNestedClass() = 0;
};
Foo();

Loading…
Cancel
Save