Browse Source

Fixed uncompilable C# code when having a function pointer with an enum pointer as a parameter.

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

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

@ -298,6 +298,9 @@ namespace CppSharp.Generators.CSharp
Enumeration @enum; Enumeration @enum;
if (desugared.TryGetEnum(out @enum)) if (desugared.TryGetEnum(out @enum))
{ {
if (MarshalKind == CSharpMarshalKind.GenericDelegate && isManagedContext)
return IntPtrType;
// Skip one indirection if passed by reference // Skip one indirection if passed by reference
var param = Context.Parameter; var param = Context.Parameter;
if (isManagedContext && param != null && (param.IsOut || param.IsInOut) if (isManagedContext && param != null && (param.IsOut || param.IsInOut)

2
tests/CSharp/CSharp.h

@ -624,6 +624,8 @@ public:
int property(); int property();
void setProperty(int value); void setProperty(int value);
void function(bool* ok = 0); void function(bool* ok = 0);
typedef void HasPointerToEnum(Property* pointerToEnum);
HasPointerToEnum* hasPointerToEnum;
protected: protected:
void protectedFunction(); void protectedFunction();
int protectedProperty(); int protectedProperty();

Loading…
Cancel
Save