
On 07/01/2014 13:55, Benno Fünfstück wrote:
Hello,
is the following safe to do?
main = do runGhc libdir $ do ... runGhc libdir $ do ...
Or will this cause trouble? Is there state that is shared between the two calls?
The main restriction here is that you can only set the static flags once, because they depend on some global mutable state (the GLOBAL_VARs that Simon mentioned).
And what about this one:
main = do forkIO $ runGhc libdir $ do ... forkIO $ runGhc libdir $ do ...
The problem with this is the RTS linker, which is a single piece of shared global state. We could actually fix that if it became important. If you're not running interpreted code, this should be fine (apart from the static flags issue mentioned above). Cheers, Simon