From f163ceac63f17617b9a41060efe436c6dd364fbc Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Mon, 19 Aug 2013 22:58:21 +0300 Subject: [PATCH] Replaced an expression with a variable so that the & operator works. Signed-off-by: Dimitar Dobrev --- src/Generator/Generators/CSharp/CSharpMarshal.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Generator/Generators/CSharp/CSharpMarshal.cs b/src/Generator/Generators/CSharp/CSharpMarshal.cs index 545cd683..0d420440 100644 --- a/src/Generator/Generators/CSharp/CSharpMarshal.cs +++ b/src/Generator/Generators/CSharp/CSharpMarshal.cs @@ -206,7 +206,9 @@ namespace CppSharp.Generators.CSharp string instance = Context.ReturnVarName; if (ctx.Kind == CSharpMarshalKind.NativeField) { - instance = string.Format("new global::System.IntPtr(&{0})", instance); + Context.SupportBefore.WriteLine( + "var __copy = new global::System.IntPtr(&{0});", instance); + instance = "__copy"; } if (@class.IsRefType)