|
|
@ -208,21 +208,29 @@ namespace CppSharp.Generators.CSharp |
|
|
|
if (IsConstCharString(pointer)) |
|
|
|
if (IsConstCharString(pointer)) |
|
|
|
return isManagedContext ? "string" : "global::System.IntPtr"; |
|
|
|
return isManagedContext ? "string" : "global::System.IntPtr"; |
|
|
|
|
|
|
|
|
|
|
|
PrimitiveType primitive; |
|
|
|
// From http://msdn.microsoft.com/en-us/library/y31yhkeb.aspx
|
|
|
|
var desugared = pointee.Desugar(); |
|
|
|
// Any of the following types may be a pointer type:
|
|
|
|
if (desugared.IsPrimitiveType(out primitive)) |
|
|
|
// * sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, or bool.
|
|
|
|
{ |
|
|
|
// * Any enum type.
|
|
|
|
if (isManagedContext && Context.Parameter != null && |
|
|
|
// * Any pointer type.
|
|
|
|
(Context.Parameter.IsOut || Context.Parameter.IsInOut)) |
|
|
|
// * Any user-defined struct type that contains fields of unmanaged types only.
|
|
|
|
return VisitPrimitiveType(primitive, quals); |
|
|
|
var finalPointee = pointer.GetFinalPointee(); |
|
|
|
|
|
|
|
if (finalPointee.IsPrimitiveType()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Skip one indirection if passed by reference
|
|
|
|
|
|
|
|
var param = Context.Parameter; |
|
|
|
|
|
|
|
if (isManagedContext && param != null && (param.IsOut || param.IsInOut) |
|
|
|
|
|
|
|
&& pointee == finalPointee) |
|
|
|
|
|
|
|
return pointee.Visit(this, quals); |
|
|
|
|
|
|
|
|
|
|
|
if (ContextKind == CSharpTypePrinterContextKind.GenericDelegate) |
|
|
|
if (ContextKind == CSharpTypePrinterContextKind.GenericDelegate) |
|
|
|
return "global::System.IntPtr"; |
|
|
|
return "global::System.IntPtr"; |
|
|
|
|
|
|
|
|
|
|
|
return VisitPrimitiveType(primitive, quals) + "*"; |
|
|
|
return pointee.Visit(this, quals) + "*"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Class @class; |
|
|
|
Class @class; |
|
|
|
|
|
|
|
var desugared = pointee.Desugar(); |
|
|
|
if ((desugared.IsDependent || desugared.IsTagDecl(out @class)) |
|
|
|
if ((desugared.IsDependent || desugared.IsTagDecl(out @class)) |
|
|
|
&& ContextKind == CSharpTypePrinterContextKind.Native) |
|
|
|
&& ContextKind == CSharpTypePrinterContextKind.Native) |
|
|
|
{ |
|
|
|
{ |
|
|
|