[Haskell-cafe] Linking in Large ByteStrings

Tom Hawkins tomahawkins at gmail.com
Fri Jan 1 19:15:37 EST 2010


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 ...


More information about the Haskell-Cafe mailing list