[Vala] Confusing issue with static struct method: too many arguments to function



I have the following which is automatically generated by bindgen.

```c
DistinstSector distinst_sector_megabyte(uint64_t value);
```

And I have this defined in the accompanying vapi file.

```vala
    [CCode (has_type_id = false)]
    public struct Sector {
        SectorKind flag;
        uint64 value;

        public static Sector start ();
        public static Sector end ();
        public static Sector unit (uint64 value);
        public static Sector megabyte (uint64 value);
    }
```

I'm attempting to use this within Vala like so

```vala
var end = disk.get_sector (Sector.megabyte (512));
```

But I am getting this error message

```
error: too many arguments to function ‘distinst_sector_megabyte’
```

And the generated C from Vala's compiler is inserting an extra argument.
```
distinst_sector_megabyte ((guint64) 512, &_tmp39_);
```

Any ideas?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]