This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Defining a CPP macro that defines a macro

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

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]