Commit 0c5242e
committed
COMP: Fix MSVC linker errors for jsonxx Empty* globals
Replace `static const Object EmptyObject = {};` (and Array, Value
variants) with `inline` accessor functions returning a local static.
The `static const` form creates per-TU copies whose constructors
reference symbols defined in jsonxx.cc — when the header test TU
links against the shared library on Windows, MSVC cannot resolve
these symbols because they lack __declspec(dllexport).
The `inline` function with a local static is C++17-safe, ODR-correct,
and avoids the linker dependency entirely.1 parent f5131b0 commit 0c5242e
1 file changed
Lines changed: 18 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
223 | 228 | | |
224 | 229 | | |
225 | 230 | | |
| |||
298 | 303 | | |
299 | 304 | | |
300 | 305 | | |
301 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
302 | 312 | | |
303 | 313 | | |
304 | 314 | | |
| |||
515 | 525 | | |
516 | 526 | | |
517 | 527 | | |
518 | | - | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
519 | 534 | | |
520 | 535 | | |
521 | 536 | | |
| |||
0 commit comments