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



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ā€¦

Here is a dump of the gir file:

<?xml version="1.0"?>
<!-- This file was automatically generated from C sources - DO NOT EDIT!
To affect the contents of this file, edit the original C definitions,
and/or use gtk-doc annotations.  -->
<repository version="1.2"
            xmlns="http://www.gtk.org/introspection/core/1.0"
            xmlns:c="http://www.gtk.org/introspection/c/1.0"
            xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
  <include name="GObject" version="2.0"/>
  <c:include name="gi_api.h"/>
  <namespace name="GiTest"
             version="1.0"
             shared-library="/usr/local/lib/libgi-test.0.dylib"
             c:identifier-prefixes="GiTest"
             c:symbol-prefixes="gi_test">
    <record name="Foo"
            c:type="gi_test_foo"
            glib:type-name="GiTestFoo"
            glib:get-type="gi_test_foo_get_type"
            c:symbol-prefix="foo">
      <doc xml:space="preserve">our main struct</doc>
      <field name="just_an_int" writable="1">
        <doc xml:space="preserve">just an int</doc>
        <type name="gint" c:type="int"/>
      </field>
      <function name="copy" c:identifier="gi_test_foo_copy" introspectable="0">
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <parameter name="A" transfer-ownership="none">
            <type c:type="gi_test_foo*"/>
          </parameter>
          <parameter name="B" transfer-ownership="none">
            <type c:type="gi_test_foo**"/>
          </parameter>
        </parameters>
      </function>
      <function name="free" c:identifier="gi_test_foo_free" introspectable="0">
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
        </return-value>
        <parameters>
          <parameter name="foo" transfer-ownership="none">
            <type c:type="gi_test_foo*"/>
          </parameter>
        </parameters>
      </function>
      <function name="new" c:identifier="gi_test_foo_new" introspectable="0">
        <return-value transfer-ownership="full">
          <doc xml:space="preserve">newly allocated struct</doc>
          <type c:type="gi_test_foo*"/>
        </return-value>
      </function>
    </record>
  </namespace>
</repository>


I would be most grateful if anyone could have a look at my reproducer and perhaps point out where my mistake lies. I am sure it

This should do the trick:

cd gi-test
autoreconf -fi
./configure --enable-introspection
make

Many thanks in advance and best regards,

Tom


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