Browse Source

This fixes out or in/out enum parameters to generate correctly.

pull/268/head
Tom Spilman 12 years ago
parent
commit
f60d267168
  1. 4
      src/Generator/Generators/CSharp/CSharpMarshal.cs
  2. 8
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs

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

@ -149,7 +149,7 @@ namespace CppSharp.Generators.CSharp @@ -149,7 +149,7 @@ namespace CppSharp.Generators.CSharp
}
PrimitiveType primitive;
if (pointee.IsPrimitiveType(out primitive))
if (pointee.IsPrimitiveType(out primitive) || pointee.IsEnumType())
{
var param = Context.Parameter;
if (param != null && (param.IsOut || param.IsInOut))
@ -462,7 +462,7 @@ namespace CppSharp.Generators.CSharp @@ -462,7 +462,7 @@ namespace CppSharp.Generators.CSharp
}
PrimitiveType primitive;
if (pointee.IsPrimitiveType(out primitive))
if (pointee.IsPrimitiveType(out primitive) || pointee.IsEnumType())
{
var param = Context.Parameter;

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

@ -232,7 +232,13 @@ namespace CppSharp.Generators.CSharp @@ -232,7 +232,13 @@ namespace CppSharp.Generators.CSharp
Enumeration @enum;
if (desugared.TryGetEnum(out @enum))
{
return @enum.Name + "*";
// Skip one indirection if passed by reference
var param = Context.Parameter;
if (isManagedContext && param != null && (param.IsOut || param.IsInOut)
&& pointee == finalPointee)
return pointee.Visit(this, quals);
return pointee.Visit(this, quals) + "*";
}
Class @class;

Loading…
Cancel
Save