Browse Source

Fixed incompilable generated C# code when having a function pointer returning a pointer.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/496/merge
Dimitar Dobrev 10 years ago
parent
commit
c136e2d220
  1. 8
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs
  2. 1
      tests/CSharpTemp/CSharpTemp.h

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

@ -180,7 +180,13 @@ namespace CppSharp.Generators.CSharp @@ -180,7 +180,13 @@ namespace CppSharp.Generators.CSharp
if (!string.IsNullOrEmpty(args))
args = string.Format(", {0}", args);
return string.Format("Func<{0}{1}>", returnType.Visit(this), args);
PushContext(CSharpTypePrinterContextKind.GenericDelegate);
var returnTypePrinterResult = returnType.Visit(this);
PopContext();
return string.Format("Func<{0}{1}>", returnTypePrinterResult, args);
}
public static bool IsConstCharString(PointerType pointer)

1
tests/CSharpTemp/CSharpTemp.h

@ -10,6 +10,7 @@ public: @@ -10,6 +10,7 @@ public:
int operator[](unsigned int i);
int& operator[](int i);
int A;
int* (*functionPtrReturnsPtrParam)();
static const int rename = 5;

Loading…
Cancel
Save