Browse Source

Added half to the marshalling structures in the C# generator. (#854)

pull/857/head
Kimon Topouzidis 9 years ago committed by Dimitar Dobrev
parent
commit
551d208044
  1. 3
      src/Generator/Generators/CSharp/CSharpSources.cs
  2. 3
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs
  3. 6
      tests/Common/Common.h

3
src/Generator/Generators/CSharp/CSharpSources.cs

@ -637,8 +637,7 @@ namespace CppSharp.Generators.CSharp @@ -637,8 +637,7 @@ namespace CppSharp.Generators.CSharp
coreType = arrayType.Type.Desugar();
// we do not support the primitives below yet because their representation in C# is problematic
if (coreType.IsPrimitiveType(PrimitiveType.Int128) ||
coreType.IsPrimitiveType(PrimitiveType.UInt128) ||
coreType.IsPrimitiveType(PrimitiveType.Half))
coreType.IsPrimitiveType(PrimitiveType.UInt128))
return;
TypePrinterResult retType = TypePrinter.VisitFieldDecl(

3
src/Generator/Generators/CSharp/CSharpTypePrinter.cs

@ -514,7 +514,8 @@ namespace CppSharp.Generators.CSharp @@ -514,7 +514,8 @@ namespace CppSharp.Generators.CSharp
return GetIntString(primitive, Context.TargetInfo);
case PrimitiveType.Int128: return "__int128";
case PrimitiveType.UInt128: return "__uint128_t";
case PrimitiveType.Half: return "__fp16";
case PrimitiveType.Half: return new TypePrinterResult { Type = "fixed byte",
NameSuffix = $"[{Context.TargetInfo.HalfWidth}]"};
case PrimitiveType.Float: return "float";
case PrimitiveType.Double: return "double";
case PrimitiveType.LongDouble: return new TypePrinterResult { Type = "fixed byte",

6
tests/Common/Common.h

@ -7,12 +7,6 @@ @@ -7,12 +7,6 @@
#include <string>
#include <vector>
class TestPrimitiveTypes
{
public:
long double longDouble;
};
class DLL_API IgnoredType
{
class IgnoredNested

Loading…
Cancel
Save