Re: Invoking "not introspectable" methods



Here's a copy reply to your bug report which for some reason does not seem to make it through:

"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>.


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