Quote:
Originally Posted by knobby67
... However in common and drivers I use a few variables that are set in the source dir. I set these with externs inside the common and driver files.
|
In a nutshell, you have a poor layout for your code.
If I understood you correctly, you have external components (drivers and common) that are "reaching" into your source code for access to global variables. It is normal for a project to reference external libraries (e.g. libc or your library), but for a library to depend on a project is blasphemous.
You need to consider re-factoring your code, rather than to come up with a hokey solution. I strongly suggest that you dispense with the global variables, and instead consider declaring local variables that can be passed as parameters to functions that you call. If a function needs the value of a variable, then it should call a "getter" function that provides the value. As for the rest of your code, it is hard to speculate what you have. But from what you posted, the common code does not seem so "common".