-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
232 lines (120 loc) · 6.28 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!DOCTYPE html>
<html lang="zh">
<head>
<meta name="generator" content="Hugo 0.65.3" />
<title>Leo学习日志 — 保持学习的快乐</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="description" content="保持学习的快乐"/>
<meta name="keywords" content=""/>
<meta name="robots" content="noodp"/>
<link rel="canonical" href="/" />
<link rel="stylesheet" href="/assets/style.css">
<link rel="stylesheet" href="/style.css">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/img/apple-touch-icon-144-precomposed.png">
<link rel="shortcut icon" href="/img/favicon.png">
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Leo学习日志"/>
<meta name="twitter:description" content=""/>
<meta property="og:title" content="Leo学习日志" />
<meta property="og:description" content="" />
<meta property="og:type" content="website" />
<meta property="og:url" content="/" />
<meta property="og:updated_time" content="2019-03-02T00:00:00+00:00" /><meta property="og:site_name" content="Leo学习日志" />
<link rel="alternate" type="application/rss+xml" href="/index.xml" title="Leo学习日志" />
</head>
<body class="dark-theme">
<div class="container">
<header class="header">
<span class="header__inner">
<a href="/" class="logo" style="text-decoration: none;">
<span class="logo__mark"><svg xmlns="http://www.w3.org/2000/svg" class="greater-icon" viewBox="0 0 44 44">
<path fill="none" d="M15 8l14.729 14.382L15 35.367"/>
</svg>
</span>
<span class="logo__text">Leo学习小站</span>
<span class="logo__cursor"></span>
</a>
<span class="header__right">
<nav class="menu">
<ul class="menu__inner menu__inner--desktop">
<li><a href="/about">关于</a></li>
<li><a href="/archive">归档</a></li>
</ul>
<ul class="menu__inner menu__inner--mobile">
<li><a href="/about">关于</a></li>
<li><a href="/archive">归档</a></li>
</ul>
</nav>
<span class="menu-trigger">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/>
</svg>
</span>
<span class="theme-toggle">
<svg class="theme-toggler" width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M22 41C32.4934 41 41 32.4934 41 22C41 11.5066 32.4934 3 22
3C11.5066 3 3 11.5066 3 22C3 32.4934 11.5066 41 22 41ZM7 22C7
13.7157 13.7157 7 22 7V37C13.7157 37 7 30.2843 7 22Z"/>
</svg>
</span>
</span>
</span>
</header>
<div class="content">
<div class="posts">
<div class="post on-list">
<h1 class="post-title"><a href="/blog/2018-review/">2018年总结</a></h1>
<div class="post-meta">
<span class="post-date">
2019-02-28
</span>
</div>
<div class="post-content">
</div>
<div><a class="read-more button" href="/blog/2018-review/">Read more →</a></div>
</div>
<div class="post on-list">
<h1 class="post-title"><a href="/blog/binary-compatibility-cpp/">DLL的二进制兼容</a></h1>
<div class="post-meta">
<span class="post-date">
2018-06-08
</span>
</div>
<div class="post-content">
详解 什么是二进制兼容? 所谓二进制兼容就是在做版本升级(也可能是Bug fix)库文件的时候,不必要重新编译使用这个库的可执行文件或使用这个库的其他库文件,同时能保证程序功能不被破坏。
当然,这只是一个现象级描述,其实在一些简单的例子里,假设我们导出一个C++类,在调用时,第三方仍然不需要重新编译可以运行。如下面例子:
FastString.dll - FastString.h文件 //导出类 class __declspec(dllexport) FastString { public: FastString(); ~FastString(); size_t length() { return 0; } private: unsigned char *m_bytes; } test.exe - main.cpp文件 int main() { FastString fStr; size_t len = fStr.length(); printf("fast string length %d\n", len); _getch(); return 0; } 如果我们给导出类加上一个虚函数
virtual boole isEmpty(); // 位于 length 方法之前 重新编译FastString.dll,然后直接运行test.exe,发现仍然能打印出fast string length 0,并且没有运行错误。
所以按照上面所说,FastString.dll是二进制兼容的。然而不是的!因为它增加了一个虚函数,导致FastString实例增加了一个虚函数表(是一个void **指针),那为什么运行的时候没有错误呢?参考这个问题:SO- why new virtual function will not break binary compatibility per phenomenon?
</div>
<div><a class="read-more button" href="/blog/binary-compatibility-cpp/">Read more →</a></div>
</div>
<div class="pagination">
<div class="pagination__buttons">
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="footer__inner">
<a href="/" class="logo" style="text-decoration: none;">
<span class="logo__mark"><svg xmlns="http://www.w3.org/2000/svg" class="greater-icon" viewBox="0 0 44 44">
<path fill="none" d="M15 8l14.729 14.382L15 35.367"/>
</svg>
</span>
<span class="logo__text">Leo学习小站</span>
<span class="logo__cursor"></span>
</a>
<div class="copyright">
<span>© 2020 Powered by <a href="https://gohugo.io" target="_blank" rel="noopener">Hugo</a></span>
<span>Theme created by <a href="https://twitter.com/panr" target="_blank" rel="noopener">panr</a></span>
</div>
</div>
</footer>
<script src="/assets/main.js"></script>
<script src="/assets/prism.js"></script>
</div>
</body>
</html>