diff options
author | Kavon Farvardin <kavon@farvard.in> | 2018-09-23 15:29:37 -0500 |
---|---|---|
committer | Kavon Farvardin <kavon@farvard.in> | 2018-09-23 15:29:37 -0500 |
commit | 84c2ad99582391005b5e873198b15e9e9eb4f78d (patch) | |
tree | caa8c2f2ec7e97fbb4977263c6817c9af5025cf4 /testsuite/tests/ffi/should_run/T9274.hs | |
parent | 8ddb47cfcf5776e9a3c55fd37947c8a95e00fa12 (diff) | |
parent | e68b439fe5de61b9a2ca51af472185c62ccb8b46 (diff) | |
download | haskell-84c2ad99582391005b5e873198b15e9e9eb4f78d.tar.gz |
update to current master againwip/T13904
Diffstat (limited to 'testsuite/tests/ffi/should_run/T9274.hs')
-rw-r--r-- | testsuite/tests/ffi/should_run/T9274.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/ffi/should_run/T9274.hs b/testsuite/tests/ffi/should_run/T9274.hs new file mode 100644 index 0000000000..814deff093 --- /dev/null +++ b/testsuite/tests/ffi/should_run/T9274.hs @@ -0,0 +1,24 @@ +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE CApiFFI #-} +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE UnliftedFFITypes #-} + +module Main where + +import qualified Data.ByteString.Short.Internal as SBS +import Foreign.C.Types +import GHC.Exts + +foreign import capi unsafe "string.h strlen" + c_strlen_capi :: ByteArray# -> IO CSize + +foreign import capi unsafe "string.h memset" + c_memset_capi :: MutableByteArray# s -> CInt -> CSize -> IO () + +main :: IO () +main = do + n <- c_strlen_capi ba# + print (n == 13) + where + !(SBS.SBS ba#) = "Hello FFI!!!!\NUL" |