Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-Id: <199907090513.AAA28920@mercury.xraylith.wisc.edu> To: Rui-Tao Dong cc: cygwin AT sourceware DOT cygnus DOT com Subject: Re: Windows TRACE message In-Reply-To: Your message of "08 Jul 1999 16:12:41 PDT." Date: Fri, 09 Jul 1999 00:13:03 -0500 From: Mumit Khan 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 AT sourceware DOT cygnus DOT com