[project @ 2002-06-27 15:38:56 by simonmar]
authorsimonmar <unknown>
Thu, 27 Jun 2002 15:38:58 +0000 (15:38 +0000)
committersimonmar <unknown>
Thu, 27 Jun 2002 15:38:58 +0000 (15:38 +0000)
commit9e9367d67db0f6c4834c1f706b10afffdfac86d4
treeef0af4d0dee09d7587aa05aa21ab0c7b39363da8
parent3d89e057aea938310e8ce88a2cd89f0a2fc37f2d
[project @ 2002-06-27 15:38:56 by simonmar]
Finally fix foreign export and foreign import "wrapper" so that
exceptions raised during the call are handled properly rather than
causing the RTS to bomb out.

In particular, calling System.exitWith in a foreign export will cause
the program to terminate cleanly with the desired exit code.  All
other exceptions are printed on stderr (and the program is
terminated).

Details:

GHC.TopHandler.runMain is now called runIO, and has type IO a -> IO a
(previously it had type IO a -> IO (), but that's not general enough
for a foreign export).  The stubs for foreign export and forein import
"wrapper" now automatically wrap the computation in runIO or its dual,
runNonIO.  It turned out to be simpler to do it this way than to do
the wrapping in Haskell land (plain foreign exports don't have
wrappers in Haskell).
ghc/compiler/deSugar/DsForeign.lhs
ghc/compiler/prelude/PrelNames.lhs
ghc/compiler/rename/RnEnv.lhs
ghc/compiler/typecheck/TcModule.lhs
ghc/includes/RtsAPI.h
ghc/rts/Prelude.h