Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
静的ライブラリと 共有ライブラリの違いを実験で確認
Search
Satoru Takeuchi
PRO
December 27, 2024
Technology
160
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
静的ライブラリと 共有ライブラリの違いを実験で確認
以下動画のテキストです。
https://youtu.be/JYu85UZPzVE
Satoru Takeuchi
PRO
December 27, 2024
Transcript
7 slides
静的ライブラリと 共有ライブラリの違いを 実験で確認 Dec. 28th, 2024 Satoru Takeuchi X: satoru_takeuchi
1
はじめに • 静的ライブラリと共有ライブラリの違いを実験によって確認 • 事前知識が得られる動画 ◦ 📝 コード再利用のしくみ ライブラリ •
ソースコード ◦ https://github.com/satoru-takeuchi/youtube-sample/tree/master/0083-library • やること ◦ ある関数を定義したコードから静的ライブラリ、共有ライブラリを作る ◦ プログラムから2つのライブラリをリンクした場合の違いを確認する 2
登場人物 • main-static: 静的ライブラリlibtest.aからmultiplyという関数を呼び出す • main-dynamic: 動的ライブラリlibtest.soからmultiplyを呼び出す • libtest.{a,so}: 2つの引数を掛けた値を返す関数multiplyを定義する
3 main()のコード main-static (実行ファイル) multiply()のコー ド multiply()のコード libtest.a 共有ライブラリ multiply()のコード libtest.so main()のコード main-dynamic (実行ファイル) libtest.soを動的リ ンクしているという 情報 静的ライブラリ 他のライブラリ のコード リンク時に必要な メタデータ
確認事項 1. 動的リンク状況 a. ldd main-static b. ldd main-dynamic 2.
ライブラリファイルのサイズ a. ls -l libtest* 3. 実行ファイルのサイズ a. ls -l main-* 4
ライブラリファイルを削除するとどうなる? 1. rm libtest.a libtest.so 2. ./main-static 3. ./main-dynamic 5
main()のコード main-static (実行ファイル) multiply()のコー ド multiply()のコード libtest.a 共有ライブラリ multiply()のコード libtest.so main()のコード main-dynamic (実行ファイル) libtest.soを動的リ ンクしているという 情報 静的ライブラリ 他のライブラリ のコード リンク時に必要な メタデータ
ライブラリファイルを更新するとどうなる? 1. libtest.cを編集してmultiply()の定義を変更 2. ライブラリ再作成(make libtest.a libtest.so)後にプログラム実行 3. 実行ファイル再作成(make main-static,
main-dynamic)後にプログラム実行 6 main()のコード main-static (実行ファイル) multiply()のコー ド multiply()の 新しいコード libtest.a 共有ライブラリ multiply()の 新しいコード libtest.so main()のコード main-dynamic (実行ファイル) libtestfoo.soを動的 リンクしているという 情報 静的ライブラリ 他のライブラリ のコード リンク時に必要な メタデータ
まとめ 7 静的ライブラリ 共有ライブラリ ライブラリのサイズ 小さい 大きい ライブラリをリンクした プログラムのサイズ 大きい
小さい ライブラリファイルを 削除した後にプログラムは 動作するか 動作する 動作しない ライブラリファイルを 変更した後にプログラムの 動作は変化するか しない する
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
Btrfsのsnapshotとランダム書き込み
sat
PRO
0
23
ファイルシステムのデフラグ
sat
PRO
1
31
コピーオンライト型ファイルシステムと ランダム書き込み
sat
PRO
2
95
119-多機能ファイルシステムBtrfs_のコピー.pdf
sat
PRO
1
86
Linuxカーネルの インタフェースは変わりうる?
sat
PRO
1
120
あなたの知らないバージョン命名規則
sat
PRO
3
940
Rook: Intro and Deep Dive with Ceph
sat
PRO
1
84
Machine Check Exception
sat
PRO
2
75
バイナリダンプの模様を読む
sat
PRO
0
120
Other Decks in Technology
See All in Technology
こんなに変わった! AWSネットワークの常識
shotashiratori
4
950
並列度を下げたら速くなった — go build の重複コンパイルを実測で見る
tomoaki25
2
1.2k
AI時代における医療情報システムのセキュリティ / Security of Healthcare IT Systems in the AI Era
henryofficial
0
170
[NW-JAWS DAY]「うちのAWS、インターネット出られないんで」― AWS外の自社サービスをPrivateLinkでシュッと公開する方法
ykimi
2
560
Kiro を使うコツ (頼み方、覚えさせ方、任せ方) | 目指せ Kiro マスター 09
inariku
PRO
3
170
Intro to Kiro (One agent, every surface) | Kiro: Zero to Hero 01
inariku
PRO
2
140
速くなるほど、深く考える AI時代のQAに学ぶ
kobayashiyorimitsu
0
220
Agent Harnessはどう作る?事例から学ぶAI Agentの設計思想
sergicalsix
0
320
DevOps Agentにあらゆるセキュリティインシデントのトリアージを任せた件
jirtosterone
1
150
An Introduction to Context Ontology Accelerator (teaching AI agents what your data means)
inariku
PRO
1
270
自治体AIコンタクトセンター、何をどこに任せる?~Amazon Connect Customer +Amazon Bedrockの実践知~ / 20261107 Satoshi Torano
shift_evolve
PRO
1
140
Kiro IDE 入門 (画面の各部から、頼み方、任せ方、戻し方まで) | 目指せ Kiro マスター 02
inariku
PRO
4
250
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
4
640
New Earth Scene 8
popppiees
5
2.8k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
23k
Product Roadmaps are Hard
iamctodd
55
13k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3.1k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Building an army of robots
kneath
307
47k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
2
520
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.7k
Abbi's Birthday
coloredviolet
5
11k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k