avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] (no subject)


From: Bob Paddock
Subject: Re: [avr-gcc-list] (no subject)
Date: Mon, 30 Jan 2006 16:17:45 -0500
User-agent: Opera M2/8.50 (Win32, build 7700)


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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]