How to list dependencies of c/c++ static library?

时光毁灭记忆、已成空白 提交于 2019-12-05 20:20:18

问题


For a static library (.a file), how to list the module-level dependencies of it?

I know for a shared library (.so), we can use objdump or readelf to do this:

objdump -p test.so

or

readelf -d test.so

I can get something like

NEEDED libOne.so

NEEDED libc.so.6

But for a static library, I can only get the dependencies in symbol-level, for example, by running

objdump -T test.a

I will get some thing like:

00000000 DF UND 00000000 QByteArray::mid(int, int) const

00000000 DF UND 00000000 QUrl::fromEncoded(QByteArray const&)

00000000 DF UND 00000000 QFileInfo::fileName() const

But I need the information in module-level, does anyone know how to get that information?


回答1:


A static library have no such list of dependencies.

A static library is nothing more than an archive of object files. And as object files doesn't know what libraries they depend on, neither can a static library.



来源:https://stackoverflow.com/questions/40789518/how-to-list-dependencies-of-c-c-static-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!