<div dir="ltr">From <a href="https://ghc.haskell.org/trac/ghc/wiki/RemoteGHCi">https://ghc.haskell.org/trac/ghc/wiki/RemoteGHCi</a>:<div>"We can have multiple instances of a GHC Session on the GHC API, each running TH and/or interpreted code. Right now this is not possible because the linker's state is global."</div><div><br></div><div>Regards,</div><div>Bartosz</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-01-17 14:49 GMT+00:00 Alan & Kim Zimmerman <span dir="ltr"><<a href="mailto:alan.zimm@gmail.com" target="_blank">alan.zimm@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">At the moment there are issues with having multiple GHC API sessions<br>
in a single executable, which boil down to GHC having global<br>
variables.<br>
<br>
A quick grep over the GHC sources shows the following instances<br>
<br>
compiler/ghci/Linker.hs:90:GLOBAL_VAR_M(v_PersistentLinkerState, ...<br>
compiler/ghci/Linker.hs:91:GLOBAL_VAR(v_InitLinkerDone, ....<br>
<br>
compiler/main/StaticFlags.hs:94:GLOBAL_VAR(v_opt_C, ....<br>
compiler/main/StaticFlags.hs:95:GLOBAL_VAR(v_opt_C_ready, ....<br>
<br>
compiler/main/DynFlags.hs:4453:GLOBAL_VAR(v_unsafeGlobalDynFlags,....<br>
<br>
ghc/GHCi/UI.hs:149:GLOBAL_VAR(macros_ref,....<br>
<br>
Of these the v_unsafeGlobalDynFlags can probably be ignored, as they<br>
are intended to be used in very specific, limited circumstances only.<br>
<br>
So, would it be possible to create a structure housing the remaining<br>
ones, and somehow make it possible to access these in some kind of<br>
session? Or preferably get rid of them, or move them into existing<br>
structures such as DynFlags.<br>
<br>
This is an exploratory email, more to get a handle on what has been<br>
done/considered already in this space.<br>
<br>
The issue does have a major impact on tooling developers though.<br>
<br>
Regards<br>
  Alan<br>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></div><br></div>