>-----Original Message----- >From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] >On Behalf Of Peter P. >Sent: 25 October 2007 19:55 >To: piclist@mit.edu >Subject: Re: [EE] Global variables in projects with many C files. > > >dtweed's solution is the most elegant but I favor this (which >mostly does the same thing, but is more explicit): > >--header.h-- >#ifndef HEADER_H > >#ifndef HEADER_C >#define EXT extern >#endif > >#define BARLEN 256 > >EXT int Foo; >EXT char Bar[BARLEN]; Unless I have missed something this will fail to compile if HEADER_C is not defined, since the EXT symbol will not exist. #ifndef HEADER_C #define EXT extern #else #define EXT #endif Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist