Mail Archives: cygwin/1999/07/09/01:15:09
Rui-Tao Dong <rdong AT newport DOT com> writes:
>
> >>>>> "Mumit" == Mumit Khan <khan AT xraylith DOT wisc DOT EDU> 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 <stdio.h>
#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
- Raw text -