Hello experts,
I need to conditionate the compilation of functions in a C file by
macro definitions. I'll give an example of what I've been trying to
get, but I also accept any answer or suggestion that leads to the same
result, provided it works with the standard GNU compilation tools.
I have a set of C functions in a file, and I want to be able to
enable/disable their compilation by setting or not a macro. Here is a
short example:
#ifdef compile_A
void A()
{
...
}
#endif
#ifdef compile_B
void B()
{
..
}
#endif
However, in my case I'm manipulating very long function names. I'd
like to obtain the same effet by a set of preprocessor macros such as:
DEFINE_FUNCTION(A)
..
END_FUNCTION
DEFINE_FUNCTION(B)
..
END_FUNCTION
These macros would expand to the same output as above, or something
completely equivalent.
After digging through the cpp documentation, I have been unable to
find something that would do. I don't want to use any other layer of
preprocessing, so if someone would have a solution that works with the
standard GNU cpp, that'd be just great. |