[C2hs] Accessing an array inside a structure

Volker Wysk post at volker-wysk.de
Sat Nov 12 13:11:04 EST 2005


Hello

There appears to be a bug. Accessing a member array of a C structure via a get 
hook, produces a pointer read off the array, instead of a pointer to the 
array:

test.chs-----------------------------------------
#c
typedef struct { char str[10]; } t;
t x = { "blah" };
#endc

foo = {# get t.str #}
-------------------------------------------------

Translates to:

test.hs------------------------------------------
...
foo = (\ptr -> do {peekByteOff ptr 0 ::IO (Ptr CChar)})
...
-------------------------------------------------

Regards,
V.W.

-- 
public key fingerprint: 6A10 66F1 40A2 C441 BB55 0AA8 FAB1 4FC1 08BE 24EF


More information about the C2hs mailing list