gtk-rs / gir

Tool to generate rust bindings and user API for glib-based libraries
https://gtk-rs.org/gir/book/
MIT License
238 stars 107 forks source link

Generating functions taking va_args argument #370

Open GuillaumeGomez opened 7 years ago

GuillaumeGomez commented 7 years ago

I just thought that we could (I don't say we should though!) maybe provide these functions by using the va_list crate. Not sure if this a good idea but might be worth talking about it.

EPashkin commented 7 years ago

We better don't try implement printf-like functions (Ex. https://github.com/gtk-rs/gtk/blob/master/src/auto/actionable.rs#L25) (as I understand va_list-rs don't work with it anyway). List functions like https://developer.gnome.org/gtk3/stable/GtkCellArea.html#gtk-cell-area-cell-set can be implemented, but not sure that it really worth in rust as it has almost same speed as C, so moving for to C code don't give so much gain as in Python or other languages. It maybe good to have these functions in sys crate independently of having it in rust code (currently we comment it with /*Unimplemented*/va_list ), but as va_list-rs has big crate gcc as dependence IMHO better add it under feature.

GuillaumeGomez commented 7 years ago

The funny thing is that you can give a va_list to a function expecting va_args (like printf). I'll let you test on your own. :p

Like I said, it was just a thought I had, and yes, if added, it's behind a feature because of the huge dependency.