I recently generated the bindings to the ALSA library on my NixOS system in order to update CPAL's bindings. I believe the original set were partly generated and partly hand-rolled, but they've been around since 2014 and are missing functionality I need so I thought I would give them an update.
One difference between the original bindings and the new generated set is that the original set use
libc, while the latest rust-bindgen seems to have generated everything needed from the system libraries. That is, the generated bindings include definitions for items like
POLLOUT, etc that are normally found in
This is nice in the sense that it seems to remove the need for the
libc dependency, but I'm curious if there is a benefit to using
libc that I'm overlooking. E.g. is it still better practise to use
libc where possible to reduce the need for every set of system bindings to have their own definitions of these types? Or is this extra code-gen negligible in practice? What are the best practices in this case?
In the case that you would recommend using
libc, what is the best way to go about this? There does not seem to be an option in
rust-bindgen to use
libc where possible, only options for specifying blacklists/whitelists manually which seems like a very tedious approach.
Any thoughts/advice appreciated!