Static linking vs dynamic linking

后端 未结 17 2007
半阙折子戏
半阙折子戏 2020-11-22 07:40

Are there any compelling performance reasons to choose static linking over dynamic linking or vice versa in certain situations? I\'ve heard or read the following, but I don\

17条回答
  •  忘了有多久
    2020-11-22 08:01

    Static linking is a process in compile time when a linked content is copied into the primary binary and becomes a single binary.

    Cons:

    • compile time is longer
    • output binary is bigger

    Dynamic linking is a process in runtime when a linked content is loaded. This technic allows to:

    • upgrade linked binary without recompiling a primary one that increase an ABI stability[About]
    • has a single shared copy

    Cons:

    • start time is slower(linked content should be copied)
    • linker errors are thrown in runtime

提交回复
热议问题