为什么.so文件总是比.a文件小?(来源相同)

Why the .so file always smaller than the .a file?(the source is identical.)

本文关键字:文件 so 为什么      更新时间:2023-10-16

我在项目中使用一个。a文件,当我使用项目中的源文件和。a文件生成一个。so文件时,我发现生成的。so文件比。a文件小,

这是什么原因?

链接阶段(生成共享对象文件)将删除未使用的函数等并执行其他压缩。

编译阶段(生成。a)不会。