【问题标题】:Extract multiple objects with the same name from a library从库中提取多个同名对象
【发布时间】:2014-05-15 13:39:08
【问题描述】:

我有一个.a 文件,其中包含许多同名的对象(例如utils.o)。 当ar 实用程序只对名称进行操作时,如何提取这些对象?

【问题讨论】:

    标签: static-libraries bsd unix-ar .a


    【解决方案1】:

    man ar 揭示了这个修饰符:

       N   Uses  the  count  parameter.  This is used if there are multiple entries in the archive with the same name.
           Extract or delete instance count of the given name from the archive.
    

    因此,例如,您可以使用 ar xN 5 libfoo.a utils.o 从存档中提取第 5 个 utils.o 对象...

    【讨论】:

    • 仅限 GNU。 BSD 版本(例如在 OSX 上)没有。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-29
    • 2010-11-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多