[commit: ghc] ghc-7.10: Import rand using capi (cf621d9)

git at git.haskell.org git at git.haskell.org
Tue Apr 14 12:51:43 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/cf621d936eea7406bc87daa97346ec15a16c36f9/ghc

>---------------------------------------------------------------

commit cf621d936eea7406bc87daa97346ec15a16c36f9
Author: Reid Barton <rwbarton at gmail.com>
Date:   Thu Apr 9 11:31:20 2015 -0400

    Import rand using capi
    
    Summary: Android has no rand symbol (it's a static inline function there).
    
    Test Plan: ghc-android builds
    
    Reviewers: trofi, austin, hvr
    
    Reviewed By: hvr
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D826
    
    GHC Trac Issues: #10274
    
    (cherry picked from commit f536d89603bb49dea192b47f54416dc88da980af)


>---------------------------------------------------------------

cf621d936eea7406bc87daa97346ec15a16c36f9
 libraries/base/System/IO.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libraries/base/System/IO.hs b/libraries/base/System/IO.hs
index 52931fd..7b13552 100644
--- a/libraries/base/System/IO.hs
+++ b/libraries/base/System/IO.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE CPP, NoImplicitPrelude #-}
+{-# LANGUAGE CPP, NoImplicitPrelude, CApiFFI #-}
 
 -----------------------------------------------------------------------------
 -- |
@@ -509,7 +509,7 @@ openTempFile' loc tmp_dir template binary mode = findTempName
                   | otherwise = a ++ [pathSeparator] ++ b
 
 -- int rand(void) from <stdlib.h>, limited by RAND_MAX (small value, 32768)
-foreign import ccall "rand" c_rand :: IO CInt
+foreign import capi "stdlib.h rand" c_rand :: IO CInt
 
 -- build large digit-alike number
 rand_string :: IO String



More information about the ghc-commits mailing list