Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(886)

Side by Side Diff: docs/component_build.md

Issue 2686133003: Add a common mistake case for header-only classes in components build doc (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # The Chrome Component Build 1 # The Chrome Component Build
2 2
3 ## Introduction 3 ## Introduction
4 4
5 Release builds are “static” builds which compile to one executable and 5 Release builds are “static” builds which compile to one executable and
6 zero-to-two shared libraries (depending on the platform). This is efficient at 6 zero-to-two shared libraries (depending on the platform). This is efficient at
7 runtime, but can take a long time to link because so much code goes into a 7 runtime, but can take a long time to link because so much code goes into a
8 single binary. 8 single binary.
9 9
10 In a component build, many smaller shared libraries will be generated. This 10 In a component build, many smaller shared libraries will be generated. This
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 cases above where `_IMPLEMENTATION` is inappropriately defined or inappropriatel y 246 cases above where `_IMPLEMENTATION` is inappropriately defined or inappropriatel y
247 undefined. Use GN visibility to make sure callers don’t screw up. 247 undefined. Use GN visibility to make sure callers don’t screw up.
248 248
249 ### Putting exported symbols in static libraries 249 ### Putting exported symbols in static libraries
250 250
251 As discussed above, exported symbols should not be in static libraries because 251 As discussed above, exported symbols should not be in static libraries because
252 the object file might not be brought into the link. Even if it is brought in 252 the object file might not be brought into the link. Even if it is brought in
253 today, it might not be brought in due to completely unrelated changes in the 253 today, it might not be brought in due to completely unrelated changes in the
254 future. The result will be undefined symbol errors from other components. Use 254 future. The result will be undefined symbol errors from other components. Use
255 source sets if your component is made up of more than one target. 255 source sets if your component is made up of more than one target.
256
257 ### Exporting a symbol that is not linked in your component
brettw 2017/02/09 21:58:44 I think the confusion you ran into is specific to
258
259 If an exported symbols is not linked as part of its own component then it is
260 not exported by the generated shared library. Other components that expect to
261 see this symbol are not be able to find it which results in an undefined symbol
262 error:
263
264 some_file.obj : error LNK2001: unresolved external symbol <some definition>
265
266 For example this can happen if you have a header-only class that is not used
267 inside the module itself. A simple fix in this case is to define the symbol in
268 its own .cpp file.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698