Hi Henk-Jan,

You have come across a known, and (I'm afraid) difficult issue to fix.

While I can give an explanation below, I don't think we will be able to
fix the issue.

I will update the wiki to reflect the fact that this is a known problem,
as this information has somehow been lost in the move from the
Sourceforge.net site to the Haskell.org wiki.

Best regards
Jeremy

On Sun, 19 Oct 2008 18:46:12 +0200, "Henk-Jan van Tuyl"
<[EMAIL PROTECTED]> said:
> 
> L.S.,
> 
> The bouncing balls demo crashes GHCi when run for the second time; to  
> reproduce this:
> 1. Start GHCi
> 2. Load BouncingBalls.hs
> 3. Run main
> 4. Close the BouncingBalls window
> 5. Run main
> 
> 
> The most minimal program that reproduces this error is:
> 
> > module Main where
> 
> > import Graphics.UI.WX
> 
> > main :: IO ()
> > main = start myFrame
> >myFrame :: IO ()
> > myFrame =
> >   do
> >        f <- frameFixed [text := "Crash test"]
> >        return ()

The problem is that versions of wxWidgets after 2.4.x make use of static
C++ destructors which execute only when the executable is unloaded. This
means that when main terminates in GHCI, the wxWidgets library is not
left in a sane state (because the DLL is still loaded, and the
destructors have not run). For this reason, it is not very practical to
use recent versions of wxHaskell with GHCi.

I took a quick look, a year or so back, at continuing to support
wxWidgets 2.4.2 in wxHaskell, and I'm afraid the conclusion was that the
wxHaskell team just don't have the time available to do this (many
wxWidgets APIs have changed enough in the last three years that we would
really be maintaining two separate branches).

The alternative approach (of making this functionality work with recent
versions of the wxWidgets library) is a substantial amount of work (and
the work would be mainly in C, rather than Haskell!), as it would
require dynamically unloading wxWidgets DLLs when main terminates and
reloading them when it is run again. I'd love someone with a spare
couple of months to do this!

If it is absolutely essential for you to support incremental development
using GHCi, the only real option is to use 0.9.4-1 (see
http://sourceforge.net/project/showfiles.php?group_id=73133&package_id=73173).
I fear that this may require a little work before it will build on the
most recent versions of GHC.
 
> Software used:
> GHC 6.8.3 / wxWindows 0.10.3 / Windows XP

The same behaviour is likely to be observed on all platforms.
-- 
  Jeremy O'Donoghue
  [EMAIL PROTECTED]


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
wxhaskell-devel mailing list
wxhaskell-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-devel

Reply via email to