Skip to content

uint64_t mapped to nuint on Linux (but ulong on Windows) #574

Open
@qmfrederik

Description

@qmfrederik

Consider the following file:

#include <stdint.h>

struct rdp_bitmap
{
	uint64_t key64;             /* 26 */
};

The following code is generated on Windows (via clangsharppinvokegenerator -f .\graphics.h -n FreeRDP3 -o graphics.cs):

namespace FreeRDP3
{
    public partial struct rdp_bitmap
    {
        [NativeTypeName("uint64_t")]
        public ulong key64;
    }
}

whereas on Linux, the following code is generated (via ClangSharpPInvokeGenerator -f ./graphics.h -I /usr/lib/clang/17/include -n FreeRDP3 -o graphics.cs):

namespace FreeRDP3
{
    public partial struct rdp_bitmap
    {
        [NativeTypeName("uint64_t")]
        public nuint key64;
    }
}

The Linux mapping to nuint is incorrect, since uint64_t is, by definition, 64-bits wide and architecture-independent.

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