T O P I C R E V I E W |
William Brown |
Posted - Jan 09 2014 : 5:42:02 PM I use a rather strange method for defining globals in my embedded C code. #define _SPI_DRV_GLOBALS is put at the top of the C file associated with these this header.
#ifdef _SPI_DRV_GLOBALS // Locally defined init vals possible #define H_EXTERN_VARIABLE volatile #define H_V_I(x) x #else // defined as extern in other files #define H_EXTERN_VARIABLE extern volatile #define H_V_I(x) #endif // end #ifdef _SPI_DRV_GLOBALS H_EXTERN_VARIABLE U8 g_nLEDduration H_V_I( = 250 );
#undef H_EXTERN_VARIABLE
so the variable g_nLEDduration is global, and if any other C file includes this header it shows up defined as extern.
The issue i found is that the line: H_EXTERN_VARIABLE U8 g_nLEDduration H_V_I( = 250 ); causes the VA X not to see the reference. if I put a space in before the ; it works though
so: H_EXTERN_VARIABLE U8 g_nLEDduration H_V_I( = 250 ) ; is referenced just fine.
Bill
|
1 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Jan 11 2014 : 9:36:00 PM I am seeing the same effect here. Thank you for the clear description:
case=79527
This is quite unexpected, I would not have expected a space before the semi-colon to have such an effect. At least the solution is simple, which is good news. |
|
|