The PInvoke generator seems to use the wrong enum base type (or else, it generates values that are not always signed ints). One example is the FT_Glyph_Format enum from freetype defined here.
The tool generates:
public enum FT_Glyph_Format_
{
FT_GLYPH_FORMAT_NONE = unchecked(((uint)((byte)(0)) << 24) | ((uint)((byte)(0)) << 16) | ((uint)((byte)(0)) << 8) | (uint)((byte)(0))),
FT_GLYPH_FORMAT_COMPOSITE = unchecked(((uint)((byte)('c')) << 24) | ((uint)((byte)('o')) << 16) | ((uint)((byte)('m')) << 8) | (uint)((byte)('p'))),
FT_GLYPH_FORMAT_BITMAP = unchecked(((uint)((byte)('b')) << 24) | ((uint)((byte)('i')) << 16) | ((uint)((byte)('t')) << 8) | (uint)((byte)('s'))),
FT_GLYPH_FORMAT_OUTLINE = unchecked(((uint)((byte)('o')) << 24) | ((uint)((byte)('u')) << 16) | ((uint)((byte)('t')) << 8) | (uint)((byte)('l'))),
FT_GLYPH_FORMAT_PLOTTER = unchecked(((uint)((byte)('p')) << 24) | ((uint)((byte)('l')) << 16) | ((uint)((byte)('o')) << 8) | (uint)((byte)('t'))),
FT_GLYPH_FORMAT_SVG = unchecked(((uint)((byte)('S')) << 24) | ((uint)((byte)('V')) << 16) | ((uint)((byte)('G')) << 8) | (uint)((byte)(' '))),
}
It seems like the macro is expanded/converted correctly, but it produces uint. Either, the enum should use uint as base type, or the individual values need to be cast to int using unchecked((int) expr). I think both would yield correct code/bindings.
The PInvoke generator seems to use the wrong enum base type (or else, it generates values that are not always signed ints). One example is the
FT_Glyph_Formatenum fromfreetypedefined here.The tool generates:
It seems like the macro is expanded/converted correctly, but it produces
uint. Either, the enum should useuintas base type, or the individual values need to be cast to int usingunchecked((int) expr). I think both would yield correct code/bindings.