OLD | NEW |
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 Loading... |
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 functions and classes implemented in headers |
| 258 |
| 259 When you implement a symbol in a header the compiler will put that in every |
| 260 necessary translation unit and the linker will pick one. If the symbol is never |
| 261 referenced by code in the shared library it's supposed exported from, it will |
| 262 never be instantiated and never exported. The result will be undefined external |
| 263 symbol errors when linking. Exported symbols should be declared in a header but |
| 264 always implemented in a .cc file. |
OLD | NEW |