From 861a979d35af3beb44a0eec83b3958b5de730bc4 Mon Sep 17 00:00:00 2001 From: triton Date: Fri, 18 Jan 2013 16:53:30 +0000 Subject: [PATCH] Struct types also need to have a default constructor taking the native instance. --- .../Generators/CLI/CLIHeadersTemplate.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs index ef0fbfa1..7553672e 100644 --- a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs +++ b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs @@ -198,20 +198,21 @@ namespace Cxxi.Generators.CLI WriteLine("{"); WriteLine("public:"); - if (!@class.IsValueType) + var nativeType = string.Format("::{0}*", @class.OriginalName); + + if (@class.IsRefType) { PushIndent(); - var nativeType = string.Format("::{0}*", @class.OriginalName); WriteLine("property {0} NativePtr;", nativeType); PopIndent(); NewLine(); - - // Output a default constructor that takes the native pointer. - PushIndent(); - WriteLine("{0}({1} native);", SafeIdentifier(@class.Name), nativeType); - PopIndent(); } + // Output a default constructor that takes the native pointer. + PushIndent(); + WriteLine("{0}({1} native);", SafeIdentifier(@class.Name), nativeType); + PopIndent(); + if (@class.IsValueType) { PushIndent();