A bad template should define Extern in every .c file. Removing is probably best, but you need to somehow replace this functionality. One approach is that you can use #define in the .c file that these global variables must define. This parameter will signal .h so as not to violate global variables.
For example: A file with one .c library:
#define FOO_LIBRARY_C #include "foo_library.h"
Other .c files:
#include "foo_library.h"
foo_library.h:
#ifdef FOO_LIBRARY_C int a,b,c #else extern int a,b,c #endif
or
#ifdef FOO_LIBRARY_C #define GLOBAL_PREFIX #else #define GLOBAL_PREFIX extern #endif GLOBAL_PREFIX int a,b,c
This reduces the need to define the same thing in every source file (except for one) and helps reduce errors. I would also not call it Extern, as it may just cause confusion, as it may or may not be "extern"
Aaron
source share