From 979057d2633dbd201e027e318829d75315ba9959 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Fri, 9 Sep 2016 23:54:56 +0300 Subject: [PATCH] Fixed the generated C# code when wrapping fixed arrays of enums. Signed-off-by: Dimitar Dobrev --- src/Generator/Generators/CSharp/CSharpTypePrinter.cs | 10 ++++++++++ tests/Common/Common.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index 145a5739..5cdd0981 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -152,6 +152,16 @@ namespace CppSharp.Generators.CSharp if (TypePrinterContext.Parameter != null) return string.Format("global::System.IntPtr"); + Enumeration @enum; + if (arrayType.TryGetEnum(out @enum)) + { + return new CSharpTypePrinterResult + { + Type = string.Format("fixed {0}", @enum.BuiltinType), + NameSuffix = string.Format("[{0}]", array.Size) + }; + } + Class @class; if (arrayType.TryGetClass(out @class)) { diff --git a/tests/Common/Common.h b/tests/Common/Common.h index 1ff5e7c2..818425e0 100644 --- a/tests/Common/Common.h +++ b/tests/Common/Common.h @@ -84,6 +84,7 @@ struct DLL_API Bar Item RetItem1() const; int A; float B; + Item fixedEnumArray[3]; Bar* returnPointerToValueType();