[Bind] Use byte for GLboolean return types

GLboolean is typedefed as an unsigned char.  It appears that `[return:
MarshalAs(UnmanagedType.U1)]` is ignored in calli p/invokes, so we need
to take care of this ourselves by emitting byte instead of bool for the
p/invoke signature. The public API remains unchanged.

Fixes issue #129.
This commit is contained in:
thefiddler 2014-06-08 09:40:30 +02:00
parent d81fc0ee10
commit 92efb5957f

View file

@ -588,6 +588,12 @@ namespace Bind
d.ReturnType.QualifiedType = "int";
}
if (d.ReturnType.CurrentType.ToLower().Contains("bool"))
{
d.ReturnType.QualifiedType = "byte";
d.ReturnType.WrapperType |= WrapperTypes.BoolParameter;
}
d.ReturnType.CurrentType = GetCLSCompliantType(d.ReturnType);
}
@ -1212,6 +1218,11 @@ namespace Bind
// Nothing else we can do, using generics will break the runtime
func.ReturnType.QualifiedType = "IntPtr";
}
if ((func.ReturnType.WrapperType & WrapperTypes.BoolParameter) != 0)
{
func.ReturnType.QualifiedType = "bool";
}
}
#endregion