Fwd: Re: [Haskell-cafe] avoiding command window with wxHaskell on Windows?

Esa Ilari Vuokko eivuokko at gmail.com
Sat Jun 30 13:13:40 EDT 2007


On 6/30/07, Duncan Coutts <duncan.coutts at worc.ox.ac.uk> wrote:
> On Fri, 2007-06-29 at 23:22 -0400, Dean Herington wrote:
> > >Date: Mon, 25 Jun 2007 20:19:50 -0400
>
> > >>With gtk2hs, using "-optl-mwindows" as a command line option for GHC lets
> > >>me get rid of this window. Perhaps it will do the same for wxHaskell?
> > >
> > >Yes, that did the trick!  Thanks a lot!
> >
> > But now I've discovered that using "-optl-mwindows" creates a program
> > that doesn't work when invoked from a command line.  Is there any way
> > to create a program that can work when invoked either from a command
> > line or through double-clicking?
>
> You'll have to be a bit more specific about what you mean. Perhaps you
> mean that when launched from the command line you cannot interact with
> the program via that command line interface. That is indeed standard
> windows behaviour.
>
> You can create new terminals at runtime using Win32 functions, but I'm
> not sure if you can figure out if the program was launched from a
> terminal and associate with that terminal.
>
> But perhaps you meant something else.

Assuming it's not something else.

As far as I know, the console/non-console application is marked in exe-header,
and you can, in principle, have two entrypoints to a program, one for
console and
one without.  Unfortunately that's not supported by most tools (and probably
none outside Microsoft toolchains.)

So, in practice, either you make console applications, or non-console
application.
And as Duncan says, you can open new console if you don't have one, but that
will have different window than parent process had.  Opening new console might
also require some interfacing with haskell runtime system if you want to use
default putStrLn and friends.  I think I saw a library to help with
that, but I can't
find it right now.

Best regards,
Esa


More information about the Haskell-Cafe mailing list