c

您所在的位置:网站首页 chemic是什么意思 c

c

2023-08-15 11:15| 来源: 网络整理| 查看: 265

c - ar 中的 "rcs"选项有什么作用?

我确实阅读了 man 文件,但它没有帮助。 rcs似乎是传递给 ar 的最流行的选项,但对我来说含义不是很清楚。 所以c意味着创建一个新的存档,但是为什么要使用 r ?这似乎代表“替换”? s 会怎样?选项做输出?

最佳答案

阅读manual page (for ar) 是一个好的开始:

c

Create the archive. The specified archive is always created if it did not exist, when you request an update. But a warning is issued unless you specify in advance that you expect to create it, by using this modifier.

r

Insert the files member… into archive (with replacement). This operation differs from q in that any previously existing members are deleted if their names match those being added.

s

Write an object-file index into the archive, or update an existing one, even if no other change is made to the archive. You may use this modifier flag either with any operation, or alone. Running “ar s” on an archive is equivalent to running ranlib on it.

与 POSIX 比较,您可能会注意到一个区别:GNU ar 使“-”前缀选项本身是可选的。

文件可以包含除目标文件之外的其他项目(尽管这并不经常这样做)。包含目标文件的文件需要额外的维护(例如,由 ranlib 完成)以使链接器可以使用它们。

根据Rationale在 POSIX ar 中,-s选项起源于 BSD(系统 V 自动执行此操作)。但是,运行 ranlib其本身就是流行的做法(-s 很少使用)。有趣的是,POSIX 没有 ranlib ,最后是 -s选项将替换 ranlib在众多为在各种平台上运行而编写的 makefile 中。 关于c - ar 中的 "rcs"选项有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29714300/



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3