* Problem with win32 GUI application using console
@ 2007-11-22 2:28 Slava Pestov
2007-11-24 13:11 ` Lewis Hyatt
0 siblings, 1 reply; 4+ messages in thread
From: Slava Pestov @ 2007-11-22 2:28 UTC (permalink / raw)
To: cygwin
Hi everybody,
I'm building a native Win32 GUI application which should be able to
display a console on demand for debugging purposes. I found that my
program was crashing when compiled with Cygwin, however it worked fine
with Visual Studio.
Here is the output of gcc --version:
gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I narrowed the problem down to a short test case. Here goes:
-------------------------
/* Compile with -mno-cygwin -mwindows */
#include <windows.h>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
if(!AllocConsole())
exit(1);
HANDLE h = GetStdHandle((intptr_t)STD_OUTPUT_HANDLE);
if(h == INVALID_HANDLE_VALUE)
exit(2);
int fd = _open_osfhandle(h,_O_TEXT);
if(fd == -1)
exit(3);
FILE *fp = _fdopen(fd,"w");
if(!fp)
exit(4);
fprintf(fp,"Hello world\n");
fflush(fp);
exit(0);
}
-------------------------
Let me know if you need any additional information.
Cheers
Slava
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem with win32 GUI application using console
2007-11-22 2:28 Problem with win32 GUI application using console Slava Pestov
@ 2007-11-24 13:11 ` Lewis Hyatt
2007-11-26 0:57 ` Slava Pestov
0 siblings, 1 reply; 4+ messages in thread
From: Lewis Hyatt @ 2007-11-24 13:11 UTC (permalink / raw)
To: cygwin
Slava Pestov wrote:
> I narrowed the problem down to a short test case. Here goes:
>
It works fine for me.
-Lewis
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem with win32 GUI application using console
2007-11-24 13:11 ` Lewis Hyatt
@ 2007-11-26 0:57 ` Slava Pestov
2007-11-26 7:33 ` Lewis Hyatt
0 siblings, 1 reply; 4+ messages in thread
From: Slava Pestov @ 2007-11-26 0:57 UTC (permalink / raw)
To: cygwin
What cygwin version and what gcc version are you using? Also can you
send me the compiled a.exe?
Slava
On 23-Nov-07, at 8:52 PM, Lewis Hyatt wrote:
> Slava Pestov wrote:
>
>> I narrowed the problem down to a short test case. Here goes:
>
>
> It works fine for me.
>
> -Lewis
>
>
> --
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
> Problem reports: http://cygwin.com/problems.html
> Documentation: http://cygwin.com/docs.html
> FAQ: http://cygwin.com/faq/
>
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem with win32 GUI application using console
2007-11-26 0:57 ` Slava Pestov
@ 2007-11-26 7:33 ` Lewis Hyatt
0 siblings, 0 replies; 4+ messages in thread
From: Lewis Hyatt @ 2007-11-26 7:33 UTC (permalink / raw)
To: cygwin
>> It works fine for me.
Slava Pestov wrote:
> What cygwin version and what gcc version are you using? Also can you
> send me the compiled a.exe?
I am using cygwin 1.5.24-2, and the most up-to-date gcc, which is
3.4.4-3 for the cygwin version, 20040810-1 for the MinGW version, which
is what is actually called.
I emailed you a gzipped tar with the source, executable, and the output
log. If you don't get it, it might have been blocked by a spam firewall
or whatever, let me know.
It might help if you can specify in what way it is failing for you. Does
it return an exit code? Or segfault? Or what?
-Lewis
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-11-26 4:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-22 2:28 Problem with win32 GUI application using console Slava Pestov
2007-11-24 13:11 ` Lewis Hyatt
2007-11-26 0:57 ` Slava Pestov
2007-11-26 7:33 ` Lewis Hyatt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).