ClangSharp
ClangSharp copied to clipboard
Struct initialization in global variable emits invalid C#
C header:
typedef struct Point
{
int x;
int y;
} Point;
Point MyGlobalPoint = { .x = 10, .y = 20 };
produces these C# bindings (missing the end curly brace on MyGlobalPoint):
namespace LibFoo.Interop
{
public partial struct Point
{
public int x;
public int y;
}
public static partial class NativeMethods
{
[NativeTypeName("struct Point")]
public static Point MyGlobalPoint = new Point
{
x = 10,
y = 20,
}
}
It works fine for const struct Point MyConstPoint = { .x = 10, .y = 20 };