From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mumit Khan To: Rui-Tao Dong Cc: cygwin@sourceware.cygnus.com Subject: Re: Windows TRACE message Date: Thu, 08 Jul 1999 22:13:00 -0000 Message-id: <199907090513.AAA28920@mercury.xraylith.wisc.edu> References: X-SW-Source: 1999-07/msg00187.html Rui-Tao Dong writes: > > >>>>> "Mumit" == Mumit Khan writes: > > >> Is there a way to re-direct windows TRACE message to stderr under > >> cygwin? > >> > > Mumit> What're windows TRACE messages? > > I mean messages shows up in VC studio's message window (produced by > TRACE macro?). > TRACE is not part of Win32 API, but rather part of MFC. However, it looks like it's a "printf" style interface, so for a console-mode program, a trivial implementation may look like the following: #include #define TRACE printf int main () { TRACE ("Entering %s\n", __PRETTY_FUNCTION__); TRACE ("Leaving %s\n", __PRETTY_FUNCTION__); return 0; } $ gcc -o foo-test foo-test.c $ ./foo-test Entering main Leaving main Of course, a reasonable implementation would something much more complicated to avoid code and runtime overhead when TRACE is turned off. Hint: define TRACE in terms of a function taking variable number of arguments and there use ANSI vfprintf routine to do the printing if tracing is enabled or just return. A win32 implementation should also check if it's GUI app; if so, open a new console (AllocConsole and so on) and write to the new console (or open a window with a text widget and send text to it). Feel free to innovate. It really isn't a Cygwin issue of course. Regards, Mumit -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe@sourceware.cygnus.com From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mumit Khan To: Rui-Tao Dong Cc: cygwin@sourceware.cygnus.com Subject: Re: Windows TRACE message Date: Sat, 31 Jul 1999 18:34:00 -0000 Message-ID: <199907090513.AAA28920@mercury.xraylith.wisc.edu> References: X-SW-Source: 1999-07n/msg00187.html Message-ID: <19990731183400.rCb5VdqwxJjLDetMk6kOGqV5DWBrlf3sHrzP4nhmknA@z> Rui-Tao Dong writes: > > >>>>> "Mumit" == Mumit Khan writes: > > >> Is there a way to re-direct windows TRACE message to stderr under > >> cygwin? > >> > > Mumit> What're windows TRACE messages? > > I mean messages shows up in VC studio's message window (produced by > TRACE macro?). > TRACE is not part of Win32 API, but rather part of MFC. However, it looks like it's a "printf" style interface, so for a console-mode program, a trivial implementation may look like the following: #include #define TRACE printf int main () { TRACE ("Entering %s\n", __PRETTY_FUNCTION__); TRACE ("Leaving %s\n", __PRETTY_FUNCTION__); return 0; } $ gcc -o foo-test foo-test.c $ ./foo-test Entering main Leaving main Of course, a reasonable implementation would something much more complicated to avoid code and runtime overhead when TRACE is turned off. Hint: define TRACE in terms of a function taking variable number of arguments and there use ANSI vfprintf routine to do the printing if tracing is enabled or just return. A win32 implementation should also check if it's GUI app; if so, open a new console (AllocConsole and so on) and write to the new console (or open a window with a text widget and send text to it). Feel free to innovate. It really isn't a Cygwin issue of course. Regards, Mumit -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe@sourceware.cygnus.com