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

How to declare bit global in header file

Hello all,
I'm having problem declaring bit as global in header file to avoid including
extern bit xxx
in other files. I've followed Keil instruction from this link:
http://www.keil.com/support/docs/1868.htm

So far all the variables are good, and I don't have to use
extern type variable xxx
any more. For bit I try to do this:

_DECL bit xxx _INIT(x);

but it doesn't work. Is there any way to get it through? Would it be good to use struct in this case? If so, how should I do this? Any inputs would be greatly appreciated.

Best Regards,
T.L

Parents
  • not very clear

    the trick where the op use "_DECL" takes care of the 'multiple definitions' HOWEVER he come us with
    extern unsigned char Err_B _INIT(0);

    which is a no-no

    The trick where the op use "_DECL" does not work for initialized variables.

    btw what is Init(0) never heard of it I would make it

    unsigned char Err_B = 0;

    Erik

Reply
  • not very clear

    the trick where the op use "_DECL" takes care of the 'multiple definitions' HOWEVER he come us with
    extern unsigned char Err_B _INIT(0);

    which is a no-no

    The trick where the op use "_DECL" does not work for initialized variables.

    btw what is Init(0) never heard of it I would make it

    unsigned char Err_B = 0;

    Erik

Children