diff --git a/src/Generator/Generators/CSharp/CSharpMarshal.cs b/src/Generator/Generators/CSharp/CSharpMarshal.cs index da536cd2..19b2deae 100644 --- a/src/Generator/Generators/CSharp/CSharpMarshal.cs +++ b/src/Generator/Generators/CSharp/CSharpMarshal.cs @@ -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 } PrimitiveType primitive; - if (pointee.IsPrimitiveType(out primitive)) + if (pointee.IsPrimitiveType(out primitive) || pointee.IsEnumType()) { var param = Context.Parameter; diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index 2d2989ff..80a400b4 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -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;