You want something more like this:

#ifndef _GLOBAL_H_
#define _GLOBAL_H_ (1)

#ifdef  DEFINE_SPACE_GLOBAL_H
#define EXTERN_GLOBAL
#else
#define EXTERN_GLOBAL extern
#endif

#if defined(__cplusplus) && __cplusplus
 extern "C" {
#endif

EXTERN_GLOBAL u08 RX485_oldbyte3, RX485_oldbyte2, RX485_oldbyte1;

#if defined(__cplusplus) && __cplusplus
 }
#endif

#endif /* _GLOBAL_H_ */

Then in global.c put:

#define  DEFINE_SPACE_GLOBAL_H (1) /* This line goes in *ONLY* global.c! */
#include "global.h"

Now space will be allocated in global.c, but all other
files will get the proper 'extern'.

Do not put initialized data in a header file that is included
in multiple places.  In this example the initialized data
belongs in global.c .

You can ignore the cplusplus stuff, that is just how
I have my emacs templates setup.




_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to