cvs commit: fptools/ghc/compiler/deSugar DsForeign.lhs fptools/ghc/compiler/prelude
PrelNames.lhs fptools/ghc/compiler/rename RnEnv.lhs
fptools/ghc/compiler/typecheck TcModule.lhs fptools/ghc/rts
Prelude.h fptools/libraries/base/GHC TopHandler.lhs ...
Simon Marlow
simonmar@glass.cse.ogi.edu
Thu, 27 Jun 2002 08:38:59 -0700
simonmar 2002/06/27 08:38:58 PDT
Modified files:
ghc/compiler/deSugar DsForeign.lhs
ghc/compiler/prelude PrelNames.lhs
ghc/compiler/rename RnEnv.lhs
ghc/compiler/typecheck TcModule.lhs
ghc/rts Prelude.h
libraries/base/GHC TopHandler.lhs
ghc/includes RtsAPI.h
testsuite/tests/ghc-regress/ccall/should_run all.T
Added files:
testsuite/tests/ghc-regress/ccall/should_run ffi006.hs
ffi006.stdout
ffi007.hs
ffi007.stdout
ffi008.hs
ffi008.stderr
Log:
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).
Revision Changes Path
1.69 +11 -3 fptools/ghc/compiler/deSugar/DsForeign.lhs
1.57 +2 -2 fptools/ghc/compiler/prelude/PrelNames.lhs
1.151 +3 -3 fptools/ghc/compiler/rename/RnEnv.lhs
1.139 +8 -8 fptools/ghc/compiler/typecheck/TcModule.lhs
1.20 +5 -1 fptools/ghc/rts/Prelude.h
1.8 +42 -22 fptools/libraries/base/GHC/TopHandler.lhs
1.27 +13 -2 fptools/ghc/includes/RtsAPI.h
1.11 +4 -0 fptools/testsuite/tests/ghc-regress/ccall/should_run/all.T