From 47e7e68c12d1d1c1851f8912d6d4d22d982ad560 Mon Sep 17 00:00:00 2001 From: Tom Spilman Date: Thu, 29 May 2014 13:54:27 -0500 Subject: [PATCH] Fixed IsInOut primitives to correctly pass the input value to the native code. --- src/Generator/Generators/CSharp/CSharpMarshal.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpMarshal.cs b/src/Generator/Generators/CSharp/CSharpMarshal.cs index da536cd2..6866c8bd 100644 --- a/src/Generator/Generators/CSharp/CSharpMarshal.cs +++ b/src/Generator/Generators/CSharp/CSharpMarshal.cs @@ -474,9 +474,12 @@ namespace CppSharp.Generators.CSharp { var typeName = Type.TypePrinterDelegate(pointee); - Context.SupportBefore.WriteLine("{0} _{1};", typeName, param.Name); - Context.Return.Write("&_{0}", param.Name); + if (param.IsInOut) + Context.SupportBefore.WriteLine("{0} _{1} = {1};", typeName, param.Name); + else + Context.SupportBefore.WriteLine("{0} _{1};", typeName, param.Name); + Context.Return.Write("&_{0}", param.Name); } else Context.Return.Write(Helpers.SafeIdentifier(Context.Parameter.Name));