I have a library consisting of 300 C ++ files.
A program that consumes a library does not want to dynamically reference it. (For various reasons, but the best thing is that some supported platforms do not support dynamic linking)
Then I use g ++ and ar to create a static library (.a), this file contains all the characters of all these files, including those that the library does not want to export.
I suspect that linking the consumer program to this library takes too much time, because all .o files inside .a must still have their own links, and the linker has more characters to process.
When creating a dynamic library (.dylib / .so), you can actually use a linker that can resolve all the symbols inside lib and export only those that the library wants to export. However, the result can only be βtiedβ to the consumption program at run time.
I would like to somehow get the benefits of dynamic linking, but use a static library.
If my Google searches are correct, if you think this is really impossible, I would like to understand why this is not possible, since it looks like it can win many C and C ++ programs.
source share