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
coreType = arrayType.Type.Desugar(); coreType = arrayType.Type.Desugar();
// we do not support the primitives below yet because their representation in C# is problematic // we do not support the primitives below yet because their representation in C# is problematic
if (coreType.IsPrimitiveType(PrimitiveType.Int128) || if (coreType.IsPrimitiveType(PrimitiveType.Int128) ||
coreType.IsPrimitiveType(PrimitiveType.UInt128) || coreType.IsPrimitiveType(PrimitiveType.UInt128))
coreType.IsPrimitiveType(PrimitiveType.Half))
return; return;
TypePrinterResult retType = TypePrinter.VisitFieldDecl( TypePrinterResult retType = TypePrinter.VisitFieldDecl(

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

@ -514,7 +514,8 @@ namespace CppSharp.Generators.CSharp
return GetIntString(primitive, Context.TargetInfo); return GetIntString(primitive, Context.TargetInfo);
case PrimitiveType.Int128: return "__int128"; case PrimitiveType.Int128: return "__int128";
case PrimitiveType.UInt128: return "__uint128_t"; 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.Float: return "float";
case PrimitiveType.Double: return "double"; case PrimitiveType.Double: return "double";
case PrimitiveType.LongDouble: return new TypePrinterResult { Type = "fixed byte", case PrimitiveType.LongDouble: return new TypePrinterResult { Type = "fixed byte",

6
tests/Common/Common.h

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

Loading…
Cancel
Save