|
|
|
@ -856,12 +856,29 @@ namespace CppSharp.Generators.CSharp
@@ -856,12 +856,29 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
WriteStartBraceIndent(); |
|
|
|
|
|
|
|
|
|
var marshal = new CSharpMarshalManagedToNativePrinter(ctx); |
|
|
|
|
ctx.ReturnVarName = string.Format("{0}{1}{2}", |
|
|
|
|
|
|
|
|
|
var arrayType = field.Type as ArrayType; |
|
|
|
|
|
|
|
|
|
if (arrayType != null && @class.IsValueType) |
|
|
|
|
{ |
|
|
|
|
CSharpTypePrinter typePrinter = new CSharpTypePrinter(ctx.Driver); |
|
|
|
|
string type = arrayType.CSharpType(typePrinter).Type; |
|
|
|
|
string arrPtrIden = Helpers.SafeIdentifier("arrPtr"); |
|
|
|
|
WriteLine(string.Format("fixed ({0} {1} = {2}.{3})", |
|
|
|
|
type.Replace("[]", "*"), arrPtrIden, Helpers.InstanceField, |
|
|
|
|
Helpers.SafeIdentifier(field.OriginalName))); |
|
|
|
|
WriteStartBraceIndent(); |
|
|
|
|
ctx.ReturnVarName = arrPtrIden; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
ctx.ReturnVarName = string.Format("{0}{1}{2}", |
|
|
|
|
@class.IsValueType |
|
|
|
|
? Helpers.InstanceField |
|
|
|
|
: string.Format("((Internal*) {0})", Helpers.InstanceIdentifier), |
|
|
|
|
@class.IsValueType ? "." : "->", |
|
|
|
|
Helpers.SafeIdentifier(field.OriginalName)); |
|
|
|
|
} |
|
|
|
|
param.Visit(marshal); |
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore)) |
|
|
|
@ -872,6 +889,9 @@ namespace CppSharp.Generators.CSharp
@@ -872,6 +889,9 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
WriteLine("{0} = {1};", ctx.ReturnVarName, marshal.Context.Return); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (arrayType != null && @class.IsValueType) |
|
|
|
|
WriteCloseBraceIndent(); |
|
|
|
|
|
|
|
|
|
WriteCloseBraceIndent(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -962,6 +982,20 @@ namespace CppSharp.Generators.CSharp
@@ -962,6 +982,20 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
ReturnType = decl.QualifiedType |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
var arrayType = field.Type as ArrayType; |
|
|
|
|
|
|
|
|
|
if (arrayType != null && @class.IsValueType) |
|
|
|
|
{ |
|
|
|
|
CSharpTypePrinter typePrinter = new CSharpTypePrinter(ctx.Driver); |
|
|
|
|
string type = arrayType.CSharpType(typePrinter).Type; |
|
|
|
|
string arrPtrIden = Helpers.SafeIdentifier("arrPtr"); |
|
|
|
|
WriteLine(string.Format("fixed ({0} {1} = {2}.{3})", |
|
|
|
|
type.Replace("[]","*"), arrPtrIden, Helpers.InstanceField, |
|
|
|
|
Helpers.SafeIdentifier(field.OriginalName))); |
|
|
|
|
WriteStartBraceIndent(); |
|
|
|
|
ctx.ReturnVarName = arrPtrIden; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var marshal = new CSharpMarshalNativeToManagedPrinter(ctx); |
|
|
|
|
decl.CSharpMarshalToManaged(marshal); |
|
|
|
|
|
|
|
|
@ -969,6 +1003,9 @@ namespace CppSharp.Generators.CSharp
@@ -969,6 +1003,9 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
Write(marshal.Context.SupportBefore); |
|
|
|
|
|
|
|
|
|
WriteLine("return {0};", marshal.Context.Return); |
|
|
|
|
|
|
|
|
|
if (arrayType != null && @class.IsValueType) |
|
|
|
|
WriteCloseBraceIndent(); |
|
|
|
|
} |
|
|
|
|
else if (decl is Variable) |
|
|
|
|
{ |
|
|
|
|