#781: GHCi on x86_64, cannot link to static data in shared libs
-------------------------------+--------------------------------------------
  Reporter:  guest             |          Owner:  simonmar      
      Type:  bug               |         Status:  new           
  Priority:  high              |      Milestone:  6.14.1        
 Component:  Compiler          |        Version:  6.5           
Resolution:                    |       Keywords:  getEnvironment
  Testcase:  getEnvironment01  |      Blockedby:                
Difficulty:  Unknown           |             Os:  Linux         
  Blocking:                    |   Architecture:  x86_64 (amd64)
   Failure:  GHCi crash        |  
-------------------------------+--------------------------------------------

Comment(by simonmar):

 Replying to [comment:12 igloo]:
 > Simon, do you have a testcase for this?

 {{{
 ~/scratch/781 > cat a.c
 int a = 42;
 ~/scratch/781 > gcc -shared a.c -o a.so
 ~/scratch/781 > cat b.hs
 {-# LANGUAGE Haskell2010 #-}

 import Foreign
 import Foreign.C

 foreign import ccall "&a" pa :: Ptr CInt

 main = peek pa >>= print
 ~/scratch/781 > ghc -c b.hs
 compilation IS NOT required
 ~/scratch/781 > ghc --interactive b.hs `pwd`/a.so
 GHCi, version 6.13.20100826: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading package ffi-1.0 ... linking ... done.
 Loading object (dynamic) /home/simonmar/scratch/781/a.so ... done
 final link ... done
 Ok, modules loaded: Main.
 Prelude Main> main
 -907777
 Prelude Main>
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/781#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to