diff --git a/src/Generator/Generators/CLI/CLIMarshal.cs b/src/Generator/Generators/CLI/CLIMarshal.cs index 99d920b7..8b7145bd 100644 --- a/src/Generator/Generators/CLI/CLIMarshal.cs +++ b/src/Generator/Generators/CLI/CLIMarshal.cs @@ -45,8 +45,10 @@ namespace CppSharp.Generators.CLI { var pointee = pointer.Pointee; + PrimitiveType primitive; var param = Context.Parameter; - if (param != null && (param.IsOut || param.IsInOut)) + if (param != null && (param.IsOut || param.IsInOut) && + pointee.IsPrimitiveType(out primitive)) { Context.Return.Write(Context.ReturnVarName); return true; @@ -65,7 +67,6 @@ namespace CppSharp.Generators.CLI return true; } - PrimitiveType primitive; if (pointee.Desugar().IsPrimitiveType(out primitive)) { Context.Return.Write("IntPtr({0})", Context.ReturnVarName);