Why do we have two kinds of libraries in C/C++? -
there static libraries , there shared libraries. wouldn't possible have shared ones , link them in statically if needed?
compiling once -fpic , once without seems waste. don't know assembly, shouldn't possible transform rellocatable code static code orders of magnitude faster recompiling everything?
this partially historical issue. once there static libraries. linked statically every binary system compiled. represented maintenance nightmare among other things, requiring using packages recompiled if library patched or changed.
then shared libraries came along fixing these issues. question, firstly there significant optimisations can take place in statically linked library impossible perform on dynamic one, therefore if 1 transform dynamic libraries static ones less efficient code compiled statically in first place.
secondly, modern systems use solely shared libraries anyway, there not of issue, things compiled once, shared library.
as slight aside, still relevant might prelinking. step takes away of start-up overhead (though still not achieving same performance static link) , allowing software dynamically links in libraries launch faster.
Comments
Post a Comment