This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

external reference to abs xdata

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);

any suggestions ?

Erik

Parents
  • You say you need to change that trick for the case of _at_ --- but I don't see any reasons why you think it wouldn't just work, as it is.

    I'm not entirely positive on this (read: I haven't actually tried it), but as far as I can see, for an _at_ definition, the whole point of the separation between definition and declaration is moot anyway. I.e. I'd just have

    type var _at_ addr;

    in the header file, and that's that. A variable definition with the _at_ keyword is not really a variable in the way the C programming language specification thinks of them, anyway. Generalizing C idioms to platform-specific features like this one is not guaranteed to be useful.

Reply
  • You say you need to change that trick for the case of _at_ --- but I don't see any reasons why you think it wouldn't just work, as it is.

    I'm not entirely positive on this (read: I haven't actually tried it), but as far as I can see, for an _at_ definition, the whole point of the separation between definition and declaration is moot anyway. I.e. I'd just have

    type var _at_ addr;

    in the header file, and that's that. A variable definition with the _at_ keyword is not really a variable in the way the C programming language specification thinks of them, anyway. Generalizing C idioms to platform-specific features like this one is not guaranteed to be useful.

Children
No data