[project @ 2002-06-27 15:38:58 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)
commite3464a8ec6f5b353ce60bc5e17bcf843e4e93ab0
tree2e7f242bae77e2443f09f76664f4153efa6abcf0
parent2b9dddc9114aa8a5c9c7252e9bba9269a0e65413
[project @ 2002-06-27 15:38:58 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/TopHandler.lhs