Defining a CPP macro that defines a macro
Kristis Makris
kristis.makris@asu.edu
Tue Nov 7 21:02:00 GMT 2006
I'm trying to do something like:
#define FIRST_MACRO(a,b) \
int some_global_var = a; \
int some_other_global_var = b; \
extern int some_variable; \
\#define some_function() some_other_function()
And some_other_function will use the variables some_global_var and
some_other_global_var in it's body.
There's an implementation of some_function _already_ compiled in
library. But in some cases, if FIRST_MACRO is defined, I want a source
program to use some_other_function (from that same library) instead of
some_function.
And the source program already contains calls to some_function. Hence I
want to develop FIRST_MACRO so that if this macro is defined in the
source program, then this change happens. I don't want the author of the
source program to have to manually write that huge body (there's more in
the body) defined by FIRST_MACRO.
On Tue, 2006-11-07 at 12:01 -0800, John (Eljay) Love-Jensen wrote:
> Hi Kristis,
>
> Could you provide an example of what you are trying to do?
>
> Is it something like this...
>
> #define FOO #define BAR QUUX
>
> ...or something like this...
>
> #define MAKE_ID(x, y) x ## y
>
> --Eljay
More information about the Gcc-help
mailing list