如何静态库都链接到的依赖? [英] How do static libraries do linking to dependencies?

查看:152
本文介绍了如何静态库都链接到的依赖?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有利巴。这取决于例如libSomething一个简单的事实是力霸的非联方法使得在libSomething.h一个方法的调用。如何依赖在这种情况下连接起来?是否有力霸静态链接到libSomething当它被编译或将力霸的用户需要连接到两个力霸和libSomething(LIBA使用的应用程序)?

Say I have libA. It depends on for example libSomething for the simple fact that a non inline method of libA makes a call to a method in libSomething.h. How does the dependency link up in this case? Does libA have to statically link to libSomething when it is compiled, or will a user of libA (an application using libA) need to link to both libA and libSomething?

感谢

推荐答案

静态链接仅仅是复制整个项目(函数,常量等)到生成的可执行文件。如果静态库的code包含一些共享库项目的引用,这些引用将成为生成的可执行文件的依赖关系。如果您链接库,而不是可执行文件的同样适用。

Static linking is just copying the whole items (functions, constants, etc) into the resulting executable. If a static library's code contains references to some shared library items, these references will become dependencies in the resulting executable. The same holds if you link a library instead of executable.

<一个href=\"http://www.linuxquestions.org/questions/programming-9/linux-linking-archive-static-library-with-shared-dynamic-library-467565/\">This螺纹讨论它在Linux下如何发生的。

This thread discusses how it happens in Linux.

这篇关于如何静态库都链接到的依赖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆