RE: A question about the DDK compiler and preprocessi ng

Thanks for the tips. Looks like I banged my head against the wall because
of precompiled header woes. Forgot to include “precomp.h” when I added my
new found code to my sources file. Funny (odd, not ha ha) but I did this
last time too! Arrgh.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Graham, Simon
Sent: Tuesday, October 14, 2003 1:10 PM
To: Windows System Software Devs Interest List

Hmm… Perhaps your definition of BLOCK_SIZE as 32 isn’t actually being read
beforehand… I usually rerun the compilation with /P /C to generate a .i
file with comments in cases like this, then look at the generated #line
directives to see what source files/lines are actually being processed.

/simgr

-----Original Message-----
From: Paul Benware [mailto:xxxxx@koolspan.com]
Sent: Tuesday, October 14, 2003 12:59 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] RE: A question about the DDK compiler and preprocessing

Well, that’s what I thought too.

The errors I’m getting are “macro redefinition” errors. In the example
below for instance, I’ve defined the BLOCK_SIZE to 32, but the compiler is
flagging redefinition errors in the “#if BLOCKSIZE == 16” section.
Specifically, the second occurrence of “locals” is being flagged.
Commenting out the first definition makes it happy. But the compiler
shouldn’t even be looking at this code in the first place if BLOCK_SIZE is
32!

-Paul

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Graham, Simon
Sent: Tuesday, October 14, 2003 12:50 PM
To: Windows System Software Devs Interest List

The DDK compiler is (pretty much) the same as the Visual Studio .NET
compiler and implements all the standard preprocessor stuff (you can read
the manuals online at the MSDN site).

A brief scan of the sample you gave looks fine to me; what error are you
getting?

/simgr

-----Original Message-----
From: Paul Benware [mailto:xxxxx@koolspan.com]
Sent: Tuesday, October 14, 2003 10:45 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] A question about the DDK compiler and preprocessing

Hi,

I am looking for some documentation about how the DDK (XP SP1) compiler
deals with preprocessor directives and can’t seem to find anything
substantial.

I have inherited some “generic” C code that has been to preprocessor hell
and back so that it can compile on any platform known to man (and then
some). It’s supposed to be an easy drop in set of source code for some
encryption algorithms, but so far I can’t get the compiler to cooperate.
There are all types of things like below where I get macro redefinitions.

I’m relatively new to the DDK compiler and I’ve never done anything this
complex with preprocessor commands. Any help would be appreciated. If I
can make all the conditional compilation work, that would be a dream.
Please don’t tell me I have to do “manual preprocessing” to get this to
work. That will be the nightmare.

Thanks,
Paul

// Sample follows…

#define BLOCK_SIZE 32 // in one header file

#if 1
#define ARRAYS
#endif


#if BLOCK_SIZE == 16 // in another place

#ifdef ARRAYS
#define locals(y,x) x[4], y[4]
#else
#define locals(y,x) x##0, x##1, … // a lot of other stuff

… Bunch of other nested preprocessor directives…

#elif BLOCK_SIZE == 24

#ifdef ARRAYS
#define locals(y,x) x[6], y[6]
#else
#define locals(y,x) x##0, x##1, … // a lot of other stuff


#else

#ifdef ARRAYS
#define locals(y,x) x[8], y[8]
#else
#define locals(y,x) x##0, x##1, … // a lot of other stuff



#endif


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@koolspan.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@koolspan.com To
unsubscribe send a blank email to xxxxx@lists.osr.com