Dan Winship wrote:
If an irregular function was required to use a widget, I'd hope that a marshal function could be registered for it in the metadata, providing a simpler calling convention. It would also be nice to have a standard "call this function or method" API, that would use a marshaller if available, or invoke the function directly otherwise (using libffi or something similar).On Mon, 2005-01-10 at 12:03 -0500, Matthias Clasen wrote:We should probably not cover all irregularities of C apis (varargs come to mind).It would be good to at least mention these irregular cases in the metadata even if they aren't fully described, so that if you're automatically generating bindings, the generator can print out warnings telling you that you need to wrap those methods by hand.
For many dynamic languages, this would allow bindings to be generated on request at runtime, and maybe even allow users to use libraries that haven't been wrapped yet. In essence, the bindings author would just have to bind the type system rather than all of GTK ...
Is this actually a problem though? Even if you exclude the cases where a more specific return type could have been used, a language binding is going to want to pick the most specific wrapper class to represent the value. They could use the same logic here too (also, many functions returning GtkWidget* are constructors, which would be handled slightly differently anyway).* type information for parameters and return valueLots of methods use "GtkWidget *" as a parameter or return type when the actual type required/returned is something more specific. The metadata should indicate that.
James.