gtk-rs / gir

Tool to generate rust bindings and user API for glib-based libraries
https://gtk-rs.org/gir/book/
MIT License
235 stars 105 forks source link

Ability to change record's field c_type #499

Open antoyo opened 6 years ago

antoyo commented 6 years ago

Hi. I found out (or remembered :D ) that the libsoup ffi is not generating the record SoupBuffer because the .gir file does not contain the c_type of one of its field:

    <record name="Buffer"
            c:type="SoupBuffer"
            glib:type-name="SoupBuffer"
            glib:get-type="soup_buffer_get_type"
            c:symbol-prefix="buffer">
      <field name="data" writable="1">
        <doc xml:space="preserve">the data</doc>
        <type name="gpointer"/>
      </field>

If I change the <type> tag of the field by:

        <type name="gpointer" c:type="gpointer"/>

the struct will be generated.

So, is there a way to do something like:

[[record]]
    [[record.field]]
    c_type = "gpointer"

?

Or is there another solution to this issue?

Thanks.

EPashkin commented 6 years ago

For signals we have fill_empty_signals_c_types in library_postprocessing.rs, maybe we need add this fields too, but better way fix it upstream, as seems it so frequently as for signals

EPashkin commented 6 years ago

*NOT frequently as for signals

ghost commented 6 years ago

The SoupBuffer data field is now assumed to be void* since #526.