I\'m using static initialisation to ease the process of registering some classes with a factory in C++. Unfortunately, I think the compiler is optimising out the \'unused\'
You need to use -whole-archive when linking. See the answer here:
ld linker question: the --whole-archive option