Skip to content

Structure fields with char* or char[x] do not get translated to string #250

@Timo-Weike

Description

@Timo-Weike

If I have a structure like

typedef struct {
	char* something;
	char something[20];
} Test1;

I would expect it to convert to something like

public unsafe partial struct Test1
{
    [NativeTypeName("char *")]
    [MarshalAs(UnmanagedType.LPStr)]
    public string something;

    [NativeTypeName("char [20]")]
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20 + 1)]
    public string something;
}

but with --std=c11 I instead get

public unsafe partial struct Test1
{
    [NativeTypeName("char *")]
    public sbyte* something;

    [NativeTypeName("char [20]")]
    public fixed sbyte something[20];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions