Last active
February 19, 2024 07:36
-
-
Save 623637646/435d0164c266f9f31bcfc4e7ceb94251 to your computer and use it in GitHub Desktop.
动态库静态库tips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. 静态库 | |
只编译不链接 | |
只要头文件在,无需设置依赖 | |
会打包进主工程二进制文件 | |
2. 动态库 | |
既编译又链接 | |
必须设置依赖 | |
不会打包进主工程二进制文件 | |
3. 当且仅当动态库依赖静态库时,才会copy静态库的代码到动态库二进制 | |
https://www.jianshu.com/p/df4876d5b385 | |
静态库的生成只有编译,没有链接; | |
动态库的生成除了编译还有链接的过程; | |
如果动态库依赖静态库,在生成动态库时会将静态库的代码合并到动态库中; | |
静态库A依赖静态库B,使用时需要在Link Binary With Libraries引入静态库A、B; | |
静态库A依赖动态库B,使用时需要在Link Binary With Libraries引入静态库A和动态库B,并且在Embeded Binaries引入动态库B; | |
动态库A依赖静态库B,使用时需要在Link Binary With Libraries引入动态库A,并且在Embeded Binaries引入动态库A; | |
动态库A依赖动态库B,使用时需要在Link Binary With Libraries引入动态库A和B,并且在Embeded Binaries引入动态库A和B; | |
Refer: https://www.valiantcat.cn/index.php/2017/04/24/45.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment