Libraries dependency : static or dynamic (Architecture)
-
@cfdev said in Libraries dependency : static or dynamic (Architecture):
Currently I use Lib1 et Lib2 in static, but in this case I think that Lib1 is duplicate in the Lib2 and App ? isnt it ?
During static linking process, the linker always optimizes the resulting binary - unused methods and objects are removed. I'm pretty sure you won't get duplicated symbols either.
-
@sierdzio said in Libraries dependency : static or dynamic (Architecture):
I'm pretty sure you won't get duplicated symbols either.
Mixing static and dynamic libs is problematic especially when the static lib is used from two different dynamic libs (or executables) since then static allocations in the static lib are duplicated for each shared lib.
--> Don't mix static and dynamic libs when possible.
-
@Christian-Ehrlicher in fact, I don't mix static and dynamic.
I just want to know if i'ts better to use dynamic or static lib in this case (lib1 is use in lib2 and App) :) ?
-
It does no matter, a static lib does not contain code of another static lib at all - it's more or less just a collection of the compiled object files.
When you don't need the libraries anywhere else I would go with static libs. -
Ok thanks, @Christian-Ehrlicher.
I'll use PRE_TARGETDEPS macro insteat of LIBS in libs, And use LIBS macro in App.++