[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AllocConsole in win_driver.c

From: Thomas Dickey
Subject: Re: AllocConsole in win_driver.c
Date: Sat, 21 Feb 2015 13:48:34 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

On Sat, Feb 21, 2015 at 01:21:12AM +0900, 顔無し wrote:
> Hello, all.
> An intrepid user by the name of avih has brought to the attention of 
> freenode#ncurses a bug in ncurses's Windows driver.  In short, ncurses's 
> Windows driver statically initializes a terminal emulator instance when 
> linked to a GUI application.  The recipe for this bug involves little more 
> than linking to the ncurses library.  More information can be found here:
> https://github.com/mxe/mxe/pull/636#issuecomment-75236009
> The offending line is here:
> https://github.com/mirror/ncurses/blob/master/ncurses/win32con/win_driver.c#L2195
> The obvious workaround involves foregoing AllocConsole() altogether, instead
> relying on AttachConsole(), but nobody in #ncurses was able to figure out the
> reason why AllocConsole() was initialized statically in the first place.

The short answer is that Juergen introduced the constructor in his
changes to support msys2.  Before then, ncurses would do AllocConsole,
but only as a result of initializing the library.  I'll have to investigate
to see if this was just a "nice" feature, or if the port to msys2 relies
on the behavior before seeing what the proper fix is.

One might assume that calling AttachConsole before AllocConsole would be
a good compromise, but the MSDN topic says that will not work -


Thomas E. Dickey <address@hidden>

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]