CppSharp icon indicating copy to clipboard operation
CppSharp copied to clipboard

Accessor for array of enum inside structs is not generated

Open XzuluX opened this issue 1 year ago • 1 comments

Brief Description

In a C header, a one-dimensional array of enum values is defined within a structure. The generated C# code does not have a property or accessor for this array.

OS: Linux Ubuntu 22.04.3 LTS

Used headers
#ifdef __cplusplus
extern "C" {
#endif

#define NR_PIXEL  10 

typedef enum
{
    LED_OFF = 0,
    LED_GREEN,
    LED_YELLOW,
    LED_RED

} sLed;

typedef struct 
{
    sLed led[NR_PIXEL];

} sPdOut;

#ifdef __cplusplus
}
#endif
Used settings

Target: Clang

Stack trace or incompilable generated code

Inside the generated code there is only a fixed uint array but no accessor.

[StructLayout(LayoutKind.Sequential, Size = 40)]
public partial struct __Internal
{
    internal fixed uint led[10];
   ...
}

XzuluX avatar Dec 20 '23 10:12 XzuluX

Related to: https://github.com/mono/CppSharp/issues/1238

tritao avatar Dec 20 '23 13:12 tritao