I am trying to come up with a method for defining absolute (MMIO) addresses once in my universal .h file. DATAACT id defined in one .c file only UX* is xdata unsigned char My attempt:
#ifdef DATACT #define UXRG(name,addr) UX8 name _at_ addr; #else #define UXRG(name,addr) extern UX8 name; #endif used as UXRG (XRleds, 0xff00);
Normally, I would put the extern reference into the .h file, and put the actual definition into the .c file (the one where you would define DATACT). No macros needed.
Normally, I would put the extern reference into the .h file, and put the actual definition into the .c file (the one where you would define DATACT). No macros needed. That is fine for small projects with no changes; however, with that method every change has to be made in 2 places and will get screwed up. Erik