[Haskell] Using putStrLn/printf from DLL in GUI application

Krasimir Angelov kr.angelov at gmail.com
Fri Dec 1 15:37:56 EST 2006


How many times you tried to use putStrLn from Haskell or printf from C
when you are building DLL loaded in GUI application?

This simply doesn't work because by default the GUI application
doesn't have console window. The solution is to use
allocConsole/freeConsole from the attached library.


Example:

do allocConsole
     .....
     .....
     putStrLn "Hello, world!"
     .....
     .....
     freeConsole

This could be a good addition to the standard Win32 library if someone
take care to integrate it.

Cheers,
   Krasimir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win32console.zip
Type: application/zip
Size: 2551 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell/attachments/20061201/9fcc2528/win32console.zip


More information about the Haskell mailing list