Re: Unresolved type and Constructors must return an instance of their class warnings



Hi Philip,

I actually managed to solve it by adding the option —accept-unprefixed to the g-ir-scanner arguments. I am surprised that this is necessary as I was already using —identifier-filter-cmd and —symbol-filter-cmd.

Thanks,

Tom

On 30 Oct 2018, at 19:29, Philip Withnall <philip tecnocode co uk> wrote:

On Mon, 2018-10-22 at 17:14 +0100, Tom Schoonjans via gir-devel-list wrote:
Dear all,


I am for the first trying to add support for gobject-introspection to one of my projects. After going through the docs and a lot of existing code for inspiration (graphene mostly), I seem to have gotten stuck as I keep getting "Unresolved type" and "Constructors must return an instance of their class" warnings for my boxed types, making the resulting typelib useless as all methods are non-introspectable.

The project is rather large, but I have managed to come up with a minimal reproducer that can be found at https://gitlab.gnome.org/tschoonj/gi-test.

From what I can tell from the gir file, it would appear that my boxed types are properly recognised, and matched with the corresponding *_get_type() functions.
The methods that use these types however are only matched with the c:type and not the record name…

My guess would be that your types don’t follow GObject naming conventions. The GType system, GObject, and GI, all expect that types are named in CamelCase. There are various places throughout the GObject introspection machinery which convert lowercase_underscore_names into CamelCaseNames. For example, GI might be converting a function name gi_test_foo_new into a proposed class name GiTestFoo, and then erroring because the function actually returns a gi_test_foo.

Philip



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