does gobject-introspection support C structs with bit fields?



Hi,

I am trying to use object introspection from Python on a C struct
defined as:

----------------------------------------------------------------
typedef struct {
  OstreeRepoCheckoutMode mode;
  OstreeRepoCheckoutOverwriteMode overwrite_mode;
  
  guint enable_uncompressed_cache : 1;
  guint disable_fsync : 1;
  guint process_whiteouts : 1;
  guint no_copy_fallback : 1;
  guint reserved : 28;

  const char *subpath;

  OstreeRepoDevInoCache *devino_to_csum_cache;

  guint unused_uints[6];
  gpointer unused_ptrs[7];
} OstreeRepoCheckoutOptions;
----------------------------------------------------------------


From the Python program I do something like:

----------------------------------------------------------------
options = OSTree.RepoCheckoutOptions()
options.process_whiteouts = True  <- corrupts subpath
options.subpath = None            <- has no effect
----------------------------------------------------------------


Setting options.process_whiteouts will corrupt options.subpath and cause
a segfault when I use the struct for calling a C function.
Even if I try to set options.subpath later (as showed in the code) the
statement has no effect as probably it is writing at the wrong offset.

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?

Thanks,
Giuseppe


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