From e29bc41a59bbf348cb3792d2ead619f916dcaef0 Mon Sep 17 00:00:00 2001 From: triton Date: Sun, 18 Aug 2013 02:04:52 +0100 Subject: [PATCH] Fixed value returns of classes bound as reference types in CLI backend. --- src/Generator/Generators/CLI/CLIMarshal.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Generator/Generators/CLI/CLIMarshal.cs b/src/Generator/Generators/CLI/CLIMarshal.cs index 2d12804b..6e1e6d90 100644 --- a/src/Generator/Generators/CLI/CLIMarshal.cs +++ b/src/Generator/Generators/CLI/CLIMarshal.cs @@ -1,6 +1,7 @@ using System; using System.Text; using CppSharp.AST; +using CppSharp.Generators.CSharp; using CppSharp.Types; using Delegate = CppSharp.AST.Delegate; @@ -177,6 +178,14 @@ namespace CppSharp.Generators.CLI instance += Context.ReturnVarName; + if (@class.IsRefType) + { + var name = Helpers.GeneratedIdentifier(Context.ReturnVarName); + Context.SupportBefore.WriteLine("auto {0} = new ::{1}({2});", name, + @class.QualifiedOriginalName, Context.ReturnVarName); + instance = name; + } + WriteClassInstance(@class, instance); return true; }