withConsole doesn't make much sense. The meaning of
allocConsole/freeConsole is more like showConsole/hideConsole. You may
want to show the console from DllMain when the dll is loaded and to
hide it when it is unloaded. You can't do this with withConsole.

Cheers,
 Krasimir

On 12/2/06, Sven Panne <[EMAIL PROTECTED]> wrote:
Am Freitag, 1. Dezember 2006 21:37 schrieb Krasimir Angelov:
> [...]
> do allocConsole
>      .....
>      .....
>      putStrLn "Hello, world!"
>      .....
>      .....
>      freeConsole
> [...]

Having explicit alloc/free pairs can lead to resource leaks in the presence of
exceptions. Simple solution: Merge both parts into a single function, using
"bracket" or friends internally:

  withConsole $ do
     ...
     putStrLn "I'm exception safe! :-)"
     ...

Cheers,
  S.

_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to