WPP. Wrapping DoTraceMessage with another macro

Hi all,

All my logging goes through macros and I need to add WPP tracing to this for
release builds.
As DoTraceMessage is already a macro, I can’t just substitute it with my own
as follows :

#define TRACE(fmt, …) DoTraceMessage(EMDRIVER, fmt “\n”, ##VA_ARGS)

because the second macro doesn’t get preprocessed therefore DoTraceMessage
ends up in the source instead of expanding.

Does anyone have a trick to get around this?

Cheers,
Ged.

Look at the documentation, you can use -func to make any function a WPP
tracing function. Check out
http://msdn.microsoft.com/en-us/library/ff597683(VS.85).aspx

Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

“Ged Murphy” wrote in message
news:xxxxx@ntdev:

> Hi all,
>
> All my logging goes through macros and I need to add WPP tracing to this for
> release builds.
> As DoTraceMessage is already a macro, I can’t just substitute it with my own
> as follows :
>
> #define TRACE(fmt, …) DoTraceMessage(EMDRIVER, fmt “\n”, ## VA_ARGS )
>
> because the second macro doesn’t get preprocessed therefore DoTraceMessage
> ends up in the source instead of expanding.
>
> Does anyone have a trick to get around this?
>
> Cheers,
> Ged.

Don Burn wrote:

Look at the documentation, you can use -func to make any function a WPP
tracing function. Check out
http://msdn.microsoft.com/en-us/library/ff597683(VS.85).aspx

Yes, and for the original poster, you must to do it this way. WPP has
its own preprocessor, separate from the C preprocessor. The WPP
preprocessor must see the exact string in the -func parameter. It can’t
be a string that expands through macros.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Yeah, I’d read the docs related to the -func method, but due to the
structure of my debug header in nested macros,
I was hoping there was another way.

I hadn’t realized WPP used a seperate preprocessor though.
I guess I’ll need reconfigure my debug header.

Thanks for the help guys, much appreciated.

Ged.

On Thu, Mar 31, 2011 at 6:48 PM, Tim Roberts wrote:

> Don Burn wrote:
> > Look at the documentation, you can use -func to make any function a WPP
> > tracing function. Check out
> > http://msdn.microsoft.com/en-us/library/ff597683(VS.85).aspx
>
> Yes, and for the original poster, you must to do it this way. WPP has
> its own preprocessor, separate from the C preprocessor. The WPP
> preprocessor must see the exact string in the -func parameter. It can’t
> be a string that expands through macros.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>