This is the mail archive of the
mailing list for the Cygwin project.
Re: Windows TRACE message
- To: Rui-Tao Dong <email@example.com>
- Subject: Re: Windows TRACE message
- From: Mumit Khan <firstname.lastname@example.org.EDU>
- Date: Fri, 09 Jul 1999 00:13:03 -0500
- cc: email@example.com
Rui-Tao Dong <firstname.lastname@example.org> writes:
> >>>>> "Mumit" == Mumit Khan <email@example.com.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:
#define TRACE printf
TRACE ("Entering %s\n", __PRETTY_FUNCTION__);
TRACE ("Leaving %s\n", __PRETTY_FUNCTION__);
$ gcc -o foo-test foo-test.c
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.
Want to unsubscribe from this list?
Send a message to firstname.lastname@example.org