<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">---------- Forwarded message ---------<br>From: GHC <<a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a>><br>Date: Sun, Mar 6, 2016 at 1:23 PM<br>Subject: [GHC] #11683: compiled files don't load in ghci<br>To: <br>Cc: <<a href="mailto:ghc-tickets@haskell.org">ghc-tickets@haskell.org</a>><br></div><br><br>#11683: compiled files don't load in ghci<br>
-------------------------------------+-------------------------------------<br>
Reporter: George | Owner:<br>
Type: bug | Status: new<br>
Priority: high | Milestone:<br>
Component: Compiler | Version: 8.0.1-rc2<br>
Keywords: | Operating System: MacOS X<br>
Architecture: | Type of failure: Incorrect result<br>
Unknown/Multiple | at runtime<br>
Test Case: | Blocked By:<br>
Blocking: | Related Tickets:<br>
Differential Rev(s): | Wiki Page:<br>
-------------------------------------+-------------------------------------<br>
compiled files don't load in ghci<br>
<br>
{{{<br>
ghc -DYNAMIC bug.hs<br>
[1 of 1] Compiling Main ( bug.hs, bug.o )<br>
Linking bug ...<br>
bash-3.2$ ghci -ignore-dot-ghci<br>
<br>
GHCi, version 8.0.0.20160204: <a href="http://www.haskell.org/ghc/" rel="noreferrer" target="_blank">http://www.haskell.org/ghc/</a> :? for help<br>
Prelude> Prelude> :load bug<br>
[1 of 1] Compiling Main ( bug.hs, interpreted )<br>
Ok, modules loaded: Main.<br>
*Main> :show modules<br>
Main ( bug.hs, interpreted )<br>
*Main><br>
}}}<br>
<br>
According to the doc,<br>
file:///usr/local/share/doc/ghc-8.0.0.20160204/html/users_guide/ghci.html<br>
#loading-compiled-code, this should work:<br>
<br>
{{{<br>
Note the -dynamic flag to GHC: GHCi uses dynamically-linked object code<br>
(if you are on a platform that supports it), and so in order to use<br>
compiled code with GHCi it must be compiled for dynamic linking.<br>
}}}<br>
<br>
Similarly <a href="https://ghc.haskell.org/trac/ghc/ticket/8736#comment:4" rel="noreferrer" target="_blank">https://ghc.haskell.org/trac/ghc/ticket/8736#comment:4</a> says the<br>
same thing:<br>
<br>
{{{<br>
if you say :load Foo in GHCi<br>
<br>
Foo was compiled with -dynamic: loads Foo.o<br>
}}}<br>
<br>
Interestingly -fobject-code does work:<br>
<br>
{{{<br>
ghci -ignore-dot-ghci -fobject-code<br>
GHCi, version 8.0.0.20160204: <a href="http://www.haskell.org/ghc/" rel="noreferrer" target="_blank">http://www.haskell.org/ghc/</a> :? for help<br>
Prelude> :load bug<br>
[1 of 1] Compiling Main ( bug.hs, bug.o )<br>
Ok, modules loaded: Main.<br>
Prelude Main><br>
}}}<br>
<br>
Unfortunately when I do<br>
{{{<br>
ghci -v -ignore-dot-ghci -fobject-code<br>
}}}<br>
<br>
I don't see why it works. It doesn't seem to use just ghc to compile , it<br>
also uses gcc, see attached file.<br>
<br>
--<br>
Ticket URL: <<a href="http://ghc.haskell.org/trac/ghc/ticket/11683" rel="noreferrer" target="_blank">http://ghc.haskell.org/trac/ghc/ticket/11683</a>><br>
GHC <<a href="http://www.haskell.org/ghc/" rel="noreferrer" target="_blank">http://www.haskell.org/ghc/</a>><br>
The Glasgow Haskell Compiler<br>
</div></div>