Browse Source

Ignore function types to non-static member functions.

pull/225/head
Elias Holzer 12 years ago
parent
commit
172f8fbf5d
  1. 11
      src/Generator/Types/Types.cs
  2. 6
      tests/Basic/Basic.h

11
src/Generator/Types/Types.cs

@ -128,6 +128,17 @@ namespace CppSharp
Ignore(); Ignore();
return base.VisitTemplateSpecializationType(template, quals); return base.VisitTemplateSpecializationType(template, quals);
} }
public override bool VisitFunctionType(FunctionType function, TypeQualifiers quals)
{
// We don't know how to marshal non-static member functions
if (function.CallingConvention == CallingConvention.ThisCall)
{
Ignore();
return false;
}
return base.VisitFunctionType(function, quals);
}
} }
} }

6
tests/Basic/Basic.h

@ -243,12 +243,16 @@ typedef int (*DelegateInGlobalNamespace)(int);
struct DLL_API TestDelegates struct DLL_API TestDelegates
{ {
typedef int (*DelegateInClass)(int); typedef int (*DelegateInClass)(int);
typedef int(TestDelegates::*MemberDelegate)(int);
TestDelegates() : A(Double), B(Double) {} TestDelegates() : A(Double), B(Double) { C = &TestDelegates::Triple; }
static int Double(int N) { return N * 2; } static int Double(int N) { return N * 2; }
int Triple(int N) { return N * 3; }
DelegateInClass A; DelegateInClass A;
DelegateInGlobalNamespace B; DelegateInGlobalNamespace B;
// As long as we can't marshal them make sure they're ignored
MemberDelegate C;
}; };
// Tests memory leaks in constructors // Tests memory leaks in constructors

Loading…
Cancel
Save