[HOpenGL] Re: Exiting gracefully from (H)GLUT?

Calle Lejdfors calle.lejdfors.390@student.lu.se
Fri, 12 Apr 2002 11:33:22 +0200


On Fri, Apr 12, 2002 at 12:37:17AM +0200, Wolfgang Thaller wrote:
> Calle Lejdfors wrote:
> > exitWith ExitSuccess
> > 
> > That however causes a:
> > 
> > TestGLUT: fatal error: GLUT_CBWindow_d7Tf: uncaught exception
> 
> This is because GHC implements exit using an exception that is caught
> outside the main program - GHC's implementation of exitWith just doesn't work with
> callbacks.
> 
> As a workaround I suggest importing shutdownHaskellAndExit from the run-time
> system:
> 
> foreign import shutdownHaskellAndExit :: Int -> IO ()
> 

This seems to do the trick. Thanks alot!

/Calle