
20 Sep
2009
20 Sep
'09
11:39 p.m.
Hello c2hs! I'm having an issue when using get and set hooks. Take the following example c code: typedef struct { int x; int y; } point; This has easy bindings: {#pointer *point as Point#} getX :: Point -> IO CInt getX = {#get point->x#} setX :: Point -> CInt -> IO () setX p i = {#set point->x} p i But what if the header file doesn't typedef? struct point { int x; int y; }; It seems c2hs can't bind to these data structures, the straight forward way of replacing 'point' with 'struct point' isn't parsed. Any combination of parens or quotes to make it parse as a single token haven't worked - also I see nothing in the tutorial. Any advice? Thomas