Re: Invoking "not introspectable" methods





On Tue, May 23, 2017 at 3:09 PM, "Torsten Schönfeld" <kaffeetisch gmx de> wrote:
Here's a copy reply to your bug report which for some reason does not seem to make it through:

It's not a bug report, but rather request for help. Duplicated it here manually. 

"Ruslan Zakirov via RT" <bug-Glib-Object-Introspection rt cpan org>:
> Playing around with the module and vips library. Things got wrong quickly: Vips::Image->new_from_file is not generated. In .gir file it's marked with introspectable="0" attribute:
>
> 2442 <constructor name="new_from_file"
> 2443 c:identifier="vips_image_new_from_file"
> 2444 introspectable="0">
>
> Simple grep in typelib file shows that it's not there.
>
> In .h file it's marked with sentinel attribute:
>
> 437 VipsImage *vips_image_new_from_file( const char *name, ... )
> 438 __attribute__((sentinel));
>
> New to gobject world. Is something wrong with vips' gir file? with this module? Should I do some additional setup for such functions/methods?

Looks like you've done everything correctly. Functions marked as introspectable=0 are simply not available from Perl (or any other language). In this case, the reason is that vips_image_new_from_file takes a variable number of arguments (indicated by the "..."), which is not supported by the introspection framework (mainly because the actual semantics of the implementation of "..." are complicated and platform-dependent). Most gobject-based libraries with varargs functions also offer alternative functions that take arrays, but that doesn't appear to be the case here.

The Python bindings seem to have a workaround: <https://github.com/jcupitt/libvips/blob/master/python/packages/gi/overrides/Vips.py#L448>.


Ok. Python re-implements logic of new_from_file on top of introspectable API. Can I use ->invoke to call such methods? Is it supported by FFI? vips has more of such functions.
 
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list



--
Best regards, Ruslan.


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