<div dir="ltr"><br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
So at the moment you're using using Storable and a Haskell record, say:<br>
<br>
data AIOCB = AIOCB {<br>
...<br>
}<br>
<br>
and we're suggesting instead:<br>
<br>
newtype AIOCB = AIOCB (ForeignPtr AIOCB)</blockquote><div><br> ^^^ I am somewhat new to Haskell. Not a total newbie! But what exactly does the above mean? Are the three references of "AIOCB" in different namespaces? If it too much trouble to explain, can you point me at Haskell URL to read?<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
then to access a member use hsc2hs:<br>
<br>
getBlah :: AIOCB -> IO Blah<br>
getBlah (AIOCB fptr) =<br>
withForeignPtr fptr $ \ptr -> {# peek aiocb,blah #} ptr<br>
<br>
So you only access the parts you need and keep the aiocb C struct<br>
allocated on the heap (use mallocForeignPtr).<br>
<font color="#888888"><br>
Duncan<br>
<br>
</font></blockquote></div><br></div>