Skip to content

[geom] Fix Windows linkage for shape TLS access - #3

Merged
sawenzel merged 1 commit into
trwenz:twenzel/geom-false-sharing-fixesfrom
agheata:geom/pr-22955-windows-link-fix
Sep 3, 2026
Merged

[geom] Fix Windows linkage for shape TLS access#3
sawenzel merged 1 commit into
trwenz:twenzel/geom-false-sharing-fixesfrom
agheata:geom/pr-22955-windows-link-fix

Conversation

@agheata

@agheata agheata commented Sep 3, 2026

Copy link
Copy Markdown

This Pull request:

Changes or fixes:

The current Windows CI fails while linking test_thread_navigation with
unresolved references to TGeoPgon::fgInstanceCount and
TGeoXtru::fgInstanceCount.

The corresponding GetThreadData() functions are inline, causing consumer
translation units to reference these private static data members directly.
On Windows, automatically exporting DLL symbols does not provide the import
semantics required for such data references.

The instance counter is used only to pre-size the TLS vector. Resizing to
fIndex + 1 is sufficient to guarantee that the current object's non-reused
slot exists, while avoiding any reference to the counter from the inline
accessor. TLS storage is therefore grown on demand instead of being
preallocated for every existing object.

This should resolve the current Windows CI linker failures.

Validation:

  • GeomChecker and thread_navigation build successfully.
  • gtest-geom-overlap-navigation passes.
  • gtest-geom-thread-navigation passes.
  • gtest-geom-manager-lifetime passes.
  • The changed headers pass the ROOT formatting check.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #

TGeoPgon::GetThreadData() and TGeoXtru::GetThreadData() are inline, so consumer translation units directly reference fgInstanceCount. On Windows, automatically exporting DLL symbols does not provide the dllimport semantics required for static data, resulting in unresolved external symbols when linking clients.

The counter was only used to pre-size the TLS vector. Resize it to fIndex + 1 instead, which is sufficient to access the object’s non-reused slot and avoids the DLL data reference.
@sawenzel
sawenzel merged commit 8b6be5a into trwenz:twenzel/geom-false-sharing-fixes Sep 3, 2026
4 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants