
8 Feb
2006
8 Feb
'06
9:38 p.m.
Cyril Schmidt wrote:
I was thinking of something like passing the array as Ptr Int#, but how do I fetch the elements that I am interested in?
I think you want Ptr CInt and peekElemOff. If the array is declared in C as int a[100][20] and p :: Ptr CInt is a Haskell pointer to it, then a[y][x] can be accessed as peekElemOff p (y * 20 + x). This should be 100% portable. -- Ben