-
Notifications
You must be signed in to change notification settings - Fork 21
Luojh add library in dev #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
92f41c8
f4ce434
fcfc89a
241e4bb
20d8439
b6703e4
7a50397
ef01039
f8d853b
7ba354c
a22ab5c
d8a7d96
8d404dd
b091284
789c179
43b4eaf
2376e8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,118 @@ | ||||||
--- | ||||||
icon: simple/cplusplus | ||||||
--- | ||||||
|
||||||
# 链接库 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 主标题名称需与 nav 里面一致。 |
||||||
|
||||||
!!! note "主要作者" | ||||||
|
||||||
[@luojh][luojh] | ||||||
|
||||||
!!! warning "本文编写中" | ||||||
|
||||||
!!! comment "适用范围" | ||||||
|
||||||
本文介绍 Linux 上的**静态链接库** (一般为 `.a` 文件) 和**动态链接库** (一般为 `.so` 文件)。注意:这里的链接库是指包含了可执行二进制代码的库,并不是头文件 (Header file)、Python 库等。 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 括号内包含中文的情况下使用全角括号,下面其他的也一样。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Header file 不需要大写,header file 就够了 |
||||||
|
||||||
## 总览 | ||||||
|
||||||
库 (Library),是包含**可重用代码和数据**的模块。 | ||||||
|
||||||
### 构建链接库 | ||||||
|
||||||
下图给出了一般的可执行文件 (executable)、静态链接库 (static library)、动态链接库 (dynamic library) 的构建过程。 | ||||||
|
||||||
```mermaid | ||||||
flowchart TD | ||||||
source["源文件 (*.c, *.cpp)"] -->|编译| target["目标文件 (*.o)"] | ||||||
header["头文件 (*.h)"] --- source | ||||||
target -->|链接| executable["可执行文件 (ELF等)"] | ||||||
target -->|ar rcs| staticlib["静态链接库 (*.a)"] | ||||||
target -->|gcc -shared| dynamiclib["动态链接库 (*.a)"] | ||||||
ustcljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
target -->|gcc -shared| dynamiclib["动态链接库 (*.a)"] | |
target -->|<code>gcc -shared</code>| dynamiclib["动态链接库 (*.a)"] |
上面的 ar rcs
也可以这么做。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linker --> executable["可执行文件 (ELF等)"] | |
linker --> executable["可执行文件(ELF 等)"] |
ustcljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有必要讲一下预处理。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
介绍一下 extern
。
ustcljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
ustcljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
ustcljh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frankly 读到这里结束我稍微有点意外,更期待一点 in-depth 的内容……
目前这个内容量大概可以作为 101 的拓展内容……?如果介绍一些 LD_LIBRARY_PATH(例如不同 CUDA 版本等)/打包相关的也许更适合放在 201 一些。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在这个分量确实是不够的
ustcljh marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,63 +96,64 @@ nav: | |
- 章节编写指导: spec/writing.md | ||
- 贡献者: spec/contributors.md | ||
- 运维基础: | ||
- ops/index.md | ||
- 检查单: ops/checklist.md | ||
- 服务器介绍: ops/server.md | ||
- 包管理系统: ops/package.md | ||
- 服务与日志管理: ops/service.md | ||
- 存储系统: | ||
- ops/storage/index.md | ||
- 基础知识简介: ops/storage/intro.md | ||
- 分区与文件系统: ops/storage/filesystem.md | ||
- LVM: ops/storage/lvm.md | ||
- RAID: ops/storage/raid.md | ||
- 网络存储系统: ops/storage/network.md | ||
- 备份与文件传输工具: ops/storage/backup.md | ||
- ZFS: ops/storage/zfs.md | ||
- 网络系统: | ||
- ops/network/index.md | ||
- 基础知识简介: ops/network/intro.md | ||
- 网络服务实践: | ||
- ops/network-service/index.md | ||
- 网络时间同步: ops/network-service/ntp.md | ||
- 隧道组网: ops/network-service/intranet.md | ||
- Nginx: ops/network-service/nginx.md | ||
- Zeroconf: ops/network-service/zeroconf.md | ||
- 数据库: | ||
- ops/database/index.md | ||
- 关系型数据库: ops/database/rdbms.md | ||
- 键值数据库: ops/database/kv.md | ||
- 问题调试: ops/debug.md | ||
- 虚拟化技术: | ||
- ops/virtualization/index.md | ||
- 基础知识简介: ops/virtualization/intro.md | ||
- 容器: ops/virtualization/container.md | ||
- QEMU/KVM: ops/virtualization/qemu-kvm.md | ||
- 用户账户系统: ops/accounts.md | ||
- 指标监控与告警: | ||
- ops/monitor/index.md | ||
- 本机指标收集: ops/monitor/local.md | ||
- Telegraf + InfluxDB: ops/monitor/telegraf.md | ||
- Prometheus: ops/monitor/prometheus.md | ||
- Grafana: ops/monitor/grafana.md | ||
- 安全: ops/security.md | ||
- ops/index.md | ||
- 检查单: ops/checklist.md | ||
- 服务器介绍: ops/server.md | ||
- 包管理系统: ops/package.md | ||
- 服务与日志管理: ops/service.md | ||
- 存储系统: | ||
- ops/storage/index.md | ||
- 基础知识简介: ops/storage/intro.md | ||
- 分区与文件系统: ops/storage/filesystem.md | ||
- LVM: ops/storage/lvm.md | ||
- RAID: ops/storage/raid.md | ||
- 网络存储系统: ops/storage/network.md | ||
- 备份与文件传输工具: ops/storage/backup.md | ||
- ZFS: ops/storage/zfs.md | ||
- 网络系统: | ||
- ops/network/index.md | ||
- 基础知识简介: ops/network/intro.md | ||
- 网络服务实践: | ||
- ops/network-service/index.md | ||
- 网络时间同步: ops/network-service/ntp.md | ||
- 隧道组网: ops/network-service/intranet.md | ||
- Nginx: ops/network-service/nginx.md | ||
- Zeroconf: ops/network-service/zeroconf.md | ||
- 数据库: | ||
- ops/database/index.md | ||
- 关系型数据库: ops/database/rdbms.md | ||
- 键值数据库: ops/database/kv.md | ||
- 问题调试: ops/debug.md | ||
- 虚拟化技术: | ||
- ops/virtualization/index.md | ||
- 基础知识简介: ops/virtualization/intro.md | ||
- 容器: ops/virtualization/container.md | ||
- QEMU/KVM: ops/virtualization/qemu-kvm.md | ||
- 用户账户系统: ops/accounts.md | ||
- 指标监控与告警: | ||
- ops/monitor/index.md | ||
- 本机指标收集: ops/monitor/local.md | ||
- Telegraf + InfluxDB: ops/monitor/telegraf.md | ||
- Prometheus: ops/monitor/prometheus.md | ||
- Grafana: ops/monitor/grafana.md | ||
- 安全: ops/security.md | ||
- 开发速查手册: | ||
- dev/index.md | ||
- 编程语言概览: | ||
- dev/language/index.md | ||
- 前端简介: dev/language/frontend.md | ||
- Python: dev/language/python.md | ||
- C/C++ 与构建工具: dev/language/cxx.md | ||
- Shell 脚本: dev/language/shell.md | ||
- Golang: dev/language/golang.md | ||
- 版本管理与合作: dev/git.md | ||
- SSH 使用技巧: dev/ssh.md | ||
- dev/index.md | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不要修改这个文件的 indentation |
||
- 编程语言概览: | ||
- dev/language/index.md | ||
- 前端简介: dev/language/frontend.md | ||
- Python: dev/language/python.md | ||
- C/C++ 与构建工具: dev/language/cxx.md | ||
- Shell 脚本: dev/language/shell.md | ||
- Golang: dev/language/golang.md | ||
- 版本管理与合作: dev/git.md | ||
- SSH 使用技巧: dev/ssh.md | ||
- Linux 上的链接库: dev/library.md | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 层级需在「编程语言概览」下面,预期是在 cxx.md 里面。现在的内容量没法单列一个 page。 |
||
- 高级内容: | ||
- advanced/index.md | ||
- CUDA 环境简介: advanced/cuda.md | ||
- Linux 桌面与窗口系统: advanced/desktop.md | ||
- DAC 与 MAC: advanced/dac-mac.md | ||
- Caddy: advanced/caddy.md | ||
- Nmap: advanced/nmap.md | ||
- ELK: advanced/elk.md | ||
- advanced/index.md | ||
- CUDA 环境简介: advanced/cuda.md | ||
- Linux 桌面与窗口系统: advanced/desktop.md | ||
- DAC 与 MAC: advanced/dac-mac.md | ||
- Caddy: advanced/caddy.md | ||
- Nmap: advanced/nmap.md | ||
- ELK: advanced/elk.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
换个图标,和 C/C++ 的重复了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
material/book 或者 material/book-cog 不错,material/bookmark-box 也行