ClangSharp icon indicating copy to clipboard operation
ClangSharp copied to clipboard

miniaudio.h broken due to invalid anonymous union name generation

Open GideonUng opened this issue 7 months ago • 1 comments

Processing 'Include/miniaudio.h'
    /home/gidcheen/Desktop/murder_farm/Src/Services/Miniaudio/Bindings.cs(3543,28): error CS0103: The name 'Anonymous4' does not exist in the current context
    /home/gidcheen/Desktop/murder_farm/Src/Services/Miniaudio/Bindings.cs(3552,28): error CS0103: The name 'Anonymous4' does not exist in the current context
    /home/gidcheen/Desktop/murder_farm/Src/Services/Miniaudio/Bindings.cs(3561,28): error CS0103: The name 'Anonymous4' does not exist in the current context
    /home/gidcheen/Desktop/murder_farm/Src/Services/Miniaudio/Bindings.cs(3570,28): error CS0103: The name 'Anonymous4' does not exist in the current context

source of the issue:

        [NativeTypeName("__AnonymousRecord_miniaudio_L4103_C5")]
        public _Anonymous4_e__Union Anonymous;

        [UnscopedRef]
        public ref _Anonymous4_e__Union._alsa_e__Struct alsa
        {
            get
            {
                return ref Anonymous4.alsa;
            }
        }

        [UnscopedRef]
        public ref _Anonymous4_e__Union._pulse_e__Struct pulse
        {
            get
            {
                return ref Anonymous4.pulse;
            }
        }

        [UnscopedRef]
        public ref _Anonymous4_e__Union._jack_e__Struct jack
        {
            get
            {
                return ref Anonymous4.jack;
            }
        }

        [UnscopedRef]
        public ref _Anonymous4_e__Union._null_device_e__Struct null_device
        {
            get
            {
                return ref Anonymous4.null_device;
            }
        }

union value is named Anonymous but uses try to reference it as Anonymous4

GideonUng avatar May 21 '25 21:05 GideonUng

A small repro or more context so that the root issue can be resolved would be beneficial.

Contributions are also welcome

tannergooding avatar May 24 '25 02:05 tannergooding

This was likely fixed by https://github.com/dotnet/ClangSharp/pull/587 and https://github.com/dotnet/ClangSharp/pull/628

Closing for now due to lack a of repro and no response

tannergooding avatar Sep 05 '25 19:09 tannergooding