Hi,
I am trying to write some (partially) automated binding generators but functions like wgpuDeviceEnumerateFeatures are creating a bit of a headache as it is difficult to reason about them and to expose them.
I would like to suggest a type specific array type or generic interface for the arrays maybe inspired by
https://troydhanson.github.io/uthash/utarray.html
Example:
size_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeatureName * features))
Would become
size_t wgpuDeviceEnumerateFeatures(WGPUDevice device, WGPUFeatureNameArray *features))
// where
typedef struct WGPUFeatureNameArray {
WGPUFeatureName *array;
size_t size;
} WGPUFeatureNameArray;
One could expose some C like iterators for the xxxArray types.
This would be easier to expose as binding than a random pointer that in specific situations means C array.
Opinions?
Regards