Skip to content

Instantly share code, notes, and snippets.

@genuinelucifer
Created June 10, 2015 06:23
Show Gist options
  • Save genuinelucifer/d73aa4039903b0c06e6d to your computer and use it in GitHub Desktop.
Save genuinelucifer/d73aa4039903b0c06e6d to your computer and use it in GitHub Desktop.
Fixed CSharp code generation when passing CS_OUT pointer into a function
diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generat
index 90cc6c1..aa983f2 100644
--- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs
+++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs
@@ -2523,7 +2523,10 @@ public struct ParamMarshal
var paramType = param.Type;
Class @class;
- if (paramType.Desugar().TryGetClass(out @class) && @class.IsRef
+ if ( (paramType.Desugar().TryGetClass(out @class) ||
+ (paramType.IsPointer() && paramType.GetFinalPointee()
+ .Desugar().TryGetClass(out @class)))
+ && @class.IsRefType)
{
WriteLine("{0} = new {1}();", param.Name, paramType);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment