I\'m using a C++ library that can be built as either a shared or a static library. This library uses a factory technique, where static objects register themselves when the p
You can use -Wl,--whole-archive -lyourlib
, see the manpage for ld
for more info.
Any static libraries mentioned after -Wl,--whole-archive on the command line gets fully included, you can turn this off again too if you need to , as in e.g. -Wl,--whole-archive -lyourlib -Wl,--no-whole-archive -lotherlib
Use:
g++ -u <SYMBOL_NAME> ...
Note that -u is lowercase