RF: Changes to allow libgdc to be compiled as a self-contained shared dynamic library
The original code uses some crazy macros to avoid the need to declare global variables twice (declared as extern
in the header files, and then initalised in the .c
/.o
files).
This has the effect that global variables defined in the libgdc
source code are not actually provided by libgdc.a
- they are declared and used in libgdc.a
, but are initialised in client code (such as in miscmaths
), when the libgdc
header files are #include
d.
This effectively introduces a circular dependency between libgdc
, and any library which uses libgdc
- libgdc
provides the functions, but depends on the calling library to provide the global variables. Insane I say.
Anyway, this circular dependency makes it very difficult to compile libgdc
as a dynamic shared library. This commit fixes things, and should be compatible with the current static-linking build approach.