Making Windows executables...
Juan Carlos Arevalo Baeza
jcab.lists at JCABs-Rumblings.com
Sat Aug 27 20:32:52 EDT 2005
Thanx! That's exactly what I needed. The swhich was undocumented! :-P
:-) I understand the caveats well enough. You can avoid the
exceptions very easily using this code:
---8<--------------------------------------
import Foreign.C.Types
import Foreign.C.String
foreign import ccall unsafe "HsBase.h __hscore_open" c_open :: CString
-> CInt -> CInt -> IO CInt
foreign import ccall unsafe "HsBase.h dup2" dup2 :: CInt -> CInt -> IO CInt
open fname oflag pmode = withCString fname $ \c_fname -> c_open c_fname
oflag pmode
main =
fd <- open "nul" 2 0
dup2 fd 0
dup2 fd 1
dup2 fd 2
... rest of the program goes here.
---8<--------------------------------------
Suggestion for somebody: maybe we should add this (or something such)
as standard to the next version of GHC. I mean a proper switch (--mk-gui
or something such) and somehow setting the standard handles like above
when it's invoked.
JCAB
Duncan Coutts wrote:
>On Sat, 2005-08-27 at 13:42 -0700, Juan Carlos Arevalo Baeza wrote:
>
>
>> When compiling a haskell program under Windows, is there any way to
>>compile it as a GUI program instead of a console program?
>>
>>
>
>Yes, see the following FAQ from Gtk2Hs:
>
>http://haskell.org/gtk2hs/archives/2005/06/23/hiding-the-console-on-windows/
>
>and do make sure you understand the caveats.
>
>Duncan
>
>_______________________________________________
>Glasgow-haskell-users mailing list
>Glasgow-haskell-users at haskell.org
>http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
>
>
More information about the Glasgow-haskell-users
mailing list