Re: does gobject-introspection support C structs with bit fields?



This is more a bindable C API problem.

When you have C public structs, in order to make it correctly all time, you should define getters/setters for each field, this make this C API bindings friendly.

As a general recommendation, is better to hide structs members and provide public getters/setters API, this will helps not just Python but any other language supporting GObject Introspection.


El 12 sept. 2016 10:09 a. m., "Christoph Reiter" <reiter christoph gmail com> escribió:
On Thu, Jul 21, 2016 at 8:03 PM, Giuseppe Scrivano <gscrivano gnu org> wrote:
> Are C structs with bit fields supported?  We can't replace the bit
> fields at this point, as it would be a breaking change for us.  Any
> suggestions?

Doesn't look like it; at least not completely. The gir contains field
sizes but libgirepository returns 0 with g_field_info_get_size(). And
g_field_info_set_field() which is used in pygobject only looks at the
type and offset.

I'd say best file a bug with gobject-introspection.

Maybe create a new flags type and a setter function which applies them
to the bitfields as a workaround?
_______________________________________________
python-hackers-list mailing list
python-hackers-list gnome org
https://mail.gnome.org/mailman/listinfo/python-hackers-list


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