From ba4eedd131503bc3f50b4d47b61a256c5aa2b957 Mon Sep 17 00:00:00 2001 From: Tom Spilman Date: Thu, 29 May 2014 17:56:50 -0500 Subject: [PATCH] Fixed CLI to support out/inout Enums. --- src/Generator/Generators/CLI/CLITypePrinter.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Generator/Generators/CLI/CLITypePrinter.cs b/src/Generator/Generators/CLI/CLITypePrinter.cs index efb7bee9..c4c7c4a1 100644 --- a/src/Generator/Generators/CLI/CLITypePrinter.cs +++ b/src/Generator/Generators/CLI/CLITypePrinter.cs @@ -107,6 +107,8 @@ namespace CppSharp.Generators.CLI var str = string.Empty; if(param.Usage == ParameterUsage.Out) str += "[System::Runtime::InteropServices::Out] "; + else if (param.Usage == ParameterUsage.InOut) + str += "[System::Runtime::InteropServices::In, System::Runtime::InteropServices::Out] "; str += type; @@ -164,6 +166,13 @@ namespace CppSharp.Generators.CLI if (pointee.TryGetEnum(out @enum)) { var typeName = @enum.Visit(this); + + // Skip one indirection if passed by reference + var param = Context.Parameter; + if (param != null && (param.IsOut || param.IsInOut) + && pointee == finalPointee) + return string.Format("{0}", typeName); + return string.Format("{0}*", typeName); }