[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] Linking in Large ByteStrings

Subject: Re: [Haskell-cafe] Linking in Large ByteStrings
From: Tom Hawkins
Date: Sat, 2 Jan 2010 01:15:37 +0100
Thanks, this worked great.  Just a few seconds to link in a 5M
tarball.  Details:


test.s:

.global test_data
test_data:
.byte 0
.byte 1
.byte 2
...


Foo.hs:

import Foreign
import Data.ByteString.Internal
import Data.Word
import System.IO.Unsafe

foreign import ccall "&" test_data :: Ptr Word8

test :: ByteString
test = fromForeignPtr (unsafePerformIO (newForeignPtr_ test_data)) 0
lengthOfTestData


Compiled with:

ghc --make -W -fglasgow-exts -o something test.s ...
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>