[Haskell-cafe] Re: "C" buffer suggestions??

David Roundy droundy at darcs.net
Mon Jun 23 21:32:57 EDT 2008


See the Data.ByteString.Internal docs:

http://www.haskell.org/ghc/docs/latest/html/libraries/bytestring/Data-ByteString-Internal.html#v%3AtoForeignPtr

Of course, you'd better not write to the contents of that pointer, or
bad things could happen...

David

On Mon, Jun 23, 2008 at 08:18:23PM -0500, Galchin, Vasili wrote:
> e.g. on Word8 .....
> 
>          let aiocb = AIOCB{
>                        aioFd=fd,
>                        aioLioOpcode=0,
>                        aioReqPrio=0,
>                        aioOffset=0,
>                        aioBuf=??,        <<<<<<<<<<<<<<<<<<<<<   Ptr Word8
>                        aioBytes=128,
>                        aioSigevent=event}
> 
> ???
> 
> Kind regards, Vasili
> 
> On Mon, Jun 23, 2008 at 8:13 PM, Galchin, Vasili <vigalchin at gmail.com>
> wrote:
> 
> > ok .....
> >
> > 1) how do I marshall from ByteString to char * (poke)??
> >
> > 2) how do I write
> >
> >          let x =??? :: Word8
> >
> > 3) how do I write
> >
> >          let y = ??? ::ByteString
> >
> > Kind regards, Vasili
> >
> >
> >
> > On Mon, Jun 23, 2008 at 6:13 PM, Adam Langley <agl at imperialviolet.org>
> > wrote:
> >
> >> On Mon, Jun 23, 2008 at 2:27 PM, Don Stewart <dons at galois.com> wrote:
> >> > So heap allocated and collected, but not moved.
> >>
> >> My bad. In that case, you might want to work with ByteStrings all the
> >> way since it might make building the visible interface (which probably
> >> should use ByteStrings) easier.
> >>
> >>
> >> AGL


More information about the Haskell-Cafe mailing list