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
if (!VisitType(pointer, quals)) if (!VisitType(pointer, quals))
return false; 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); var refParamPtr = string.Format("__refParamPtr{0}", Context.ParameterIndex);
Context.SupportBefore.WriteLine("fixed ({0} {1} = &{2})", Context.SupportBefore.WriteLine("fixed ({0} {1} = &{2})",

2
tests/Common/Common.h

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

Loading…
Cancel
Save