I'm wanting to conditionally assign a modifier during a compile. I want to assign a modifier of "static" or "extern", depending on whether a given symbol is defined.

That is what I'm trying to code. (I haven't use C macros much).


Code:
#ifdef _MYVAR_ 
   #define MODIFIER static 
#else 
   #define MODIFIER extern 
#endif 

.
.
.
MODIFIER int foo(char *) ;

Can this be done? The above fails on the last line. I'm wanting either static or extern to be substituted.