public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Mumit Khan <khan@xraylith.wisc.EDU>
To: Rui-Tao Dong <rdong@newport.com>
Cc: cygwin@sourceware.cygnus.com
Subject: Re: Windows TRACE message
Date: Sat, 31 Jul 1999 18:34:00 -0000	[thread overview]
Message-ID: <199907090513.AAA28920@mercury.xraylith.wisc.edu> (raw)
Message-ID: <19990731183400.rCb5VdqwxJjLDetMk6kOGqV5DWBrlf3sHrzP4nhmknA@z> (raw)
In-Reply-To: <v5hfnebus6.fsf@Phantom.newport.com>

Rui-Tao Dong <rdong@newport.com> writes:
> 
> >>>>> "Mumit" == Mumit Khan <khan@xraylith.wisc.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@sourceware.cygnus.com

  reply	other threads:[~1999-07-31 18:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-08 14:53 Rui-Tao Dong
1999-07-08 16:12 ` Mumit Khan
1999-07-08 16:17   ` Rui-Tao Dong
1999-07-08 22:13     ` Mumit Khan [this message]
1999-07-08 23:28       ` Lars Gregersen
1999-07-08 23:47         ` Mumit Khan
1999-07-08 23:56           ` Lars Gregersen
1999-07-31 18:34             ` Lars Gregersen
1999-07-12  5:52           ` Jonathan Pryor
1999-07-31 18:34             ` Jonathan Pryor
1999-07-31 18:34           ` Mumit Khan
1999-07-31 18:34         ` Lars Gregersen
1999-07-31 18:34       ` Mumit Khan
1999-07-31 18:34     ` Rui-Tao Dong
1999-07-31 18:34   ` Mumit Khan
1999-07-31 18:34 ` Rui-Tao Dong
1999-07-09 17:38 Rui-Tao Dong
1999-07-11 12:34 ` Mumit Khan
1999-07-31 18:34   ` Mumit Khan
1999-07-31 18:34 ` Rui-Tao Dong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199907090513.AAA28920@mercury.xraylith.wisc.edu \
    --to=khan@xraylith.wisc.edu \
    --cc=cygwin@sourceware.cygnus.com \
    --cc=rdong@newport.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).