|
|
|
@ -208,14 +208,14 @@ namespace CppSharp.Generators.CSharp
@@ -208,14 +208,14 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
case PrimitiveType.Void: |
|
|
|
|
return true; |
|
|
|
|
case PrimitiveType.Char: |
|
|
|
|
// TODO: work around https://github.com/dotnet/coreclr/issues/1485
|
|
|
|
|
// returned structs must be blittable and char isn't
|
|
|
|
|
if (Context.Driver.Options.MarshalCharAsManagedChar) |
|
|
|
|
Context.Return.Write("(char) "); |
|
|
|
|
goto default; |
|
|
|
|
case PrimitiveType.Char16: |
|
|
|
|
return false; |
|
|
|
|
case PrimitiveType.Bool: |
|
|
|
|
// TODO: work around https://github.com/dotnet/coreclr/issues/1485
|
|
|
|
|
// returned structs must be blittable and bool isn't
|
|
|
|
|
Context.Return.Write("{0} != 0", Context.ReturnVarName); |
|
|
|
|
return true; |
|
|
|
|
default: |
|
|
|
@ -538,14 +538,14 @@ namespace CppSharp.Generators.CSharp
@@ -538,14 +538,14 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
case PrimitiveType.Void: |
|
|
|
|
return true; |
|
|
|
|
case PrimitiveType.Char: |
|
|
|
|
// TODO: work around https://github.com/dotnet/coreclr/issues/1485
|
|
|
|
|
// returned structs must be blittable and char isn't
|
|
|
|
|
if (Context.Driver.Options.MarshalCharAsManagedChar) |
|
|
|
|
Context.Return.Write("(sbyte) "); |
|
|
|
|
goto default; |
|
|
|
|
case PrimitiveType.Char16: |
|
|
|
|
return false; |
|
|
|
|
case PrimitiveType.Bool: |
|
|
|
|
// TODO: work around https://github.com/dotnet/coreclr/issues/1485
|
|
|
|
|
// returned structs must be blittable and bool isn't
|
|
|
|
|
Context.Return.Write("(byte) ({0} ? 1 : 0)", Context.Parameter.Name); |
|
|
|
|
return true; |
|
|
|
|
default: |
|
|
|
|