Joining static libraries into a shared library
kuraudo last edited by
-I'm beginning work on what will be a fairly medium-sized application using the subdirs template. Right now, the subdirs branch off to make libraries, with one subdir going to the application. This seems fine with all of the libraries statically linked. Now, I'm trying to group multiple static libraries in a subdir into a single shared library for that subdir. For example:
.main - the application core, importing gui.dll/gui.so
..widgetA - static library encapsulating widgetA
..widgetB - static library encapsulating widgetB
..gui - shared library exporting widgetA and widget@
This seems to me to be the best way to approach scaling this application, as any number of these static libraries can be quite large and this organizes dependencies quite well. I'm just not sure how to take the imports from static libraries widgetA and widgetB, and make them exports in the gui library.
ChrisW67 last edited by
It seems you are on Linux. You might find these informative:
You should be able to use the whole archive options in your LIBS variable.
LIBS += -Wl,--whole-archive -lfirst -lsecond -Wl,--no-whole-archive