
All, So I'm trying to wrap this structure: struct GtkSourceTagStyle { /* readonly */ gboolean is_default; guint mask; GdkColor foreground; GdkColor background; gboolean italic; gboolean bold; gboolean underline; gboolean strikethrough; /* Reserved for future expansion */ guint8 reserved[16]; }; My problem is with the GdkColor members foreground & background. They are themselves structures so c2hs cannot make {#get #} mappings for them. Of course Color has already been wrapped (in gtk2hs/gtk/general/Structs.hsc) and is a member of the Storable class so all we need is to get a pointer to the member to be able to apply peek/poke to it. This is not hard if we manually edit the .hs file produced from the .chs binding file: instance Storable SourceTagStyle where peek ptr = do isDefault' <- (\ptr -> do {peekByteOff ptr 0 ::IO CInt}) ptr mask' <- (\ptr -> do {peekByteOff ptr 4 ::IO CUInt}) ptr foreground' <- (\ptr -> do {peekByteOff ptr 8 ::IO Color}) ptr --manually edited background' <- (\ptr -> do {peekByteOff ptr 8+12 ::IO Color}) ptr --manually edited italic' <- (\ptr -> do {peekByteOff ptr 32 ::IO CInt}) ptr bold' <- (\ptr -> do {peekByteOff ptr 36 ::IO CInt}) ptr ... So as you see we're very close, all we need is a way of automatically getting the structure offsets (which is what c2hs does for all the other members). What is the right way do to this? Duncan