静态链接:在编译/构建阶段把程序依赖的库代码(如 .a、.lib)直接打包进最终可执行文件中。这样运行时通常不再需要依赖相应的共享库文件;但可执行文件体积往往更大,更新库也需要重新编译/链接程序。(该术语也常与 dynamic linking 对比使用。)
/ˈstætɪk ˈlɪŋkɪŋ/
I built the tool with static linking so it can run on older servers.
我用静态链接构建了这个工具,这样它可以在较旧的服务器上运行。
Although static linking can simplify deployment, it may increase the binary size and require rebuilding the application whenever a library is updated.
虽然静态链接可以简化部署,但它可能会增大可执行文件体积,并且当库更新时需要重新构建应用程序。
static 来自希腊语词根 *stat-*(“站立、不变”),在计算机语境里引申为“在构建时就固定下来的”。linking 源自 link(“连接”),指把编译产生的目标文件与库“连接”成一个可执行程序。合起来强调:依赖在生成可执行文件时就被“固定地连接进去”。