Fix MSVC handle name collisions - #230
Closed
akalari wants to merge 1 commit into
Closed
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RustHandle_*C++ aliasHandle_*names with CXX#[cxx_name]mappings across all split bridgesRoot cause
PR #196 fixed Windows handle-name conflicts in the original monolithic bridge. PR #199 (
7e8d78a) later split that bridge and restored names such asHandle_Geom_Surface,Handle_Geom_Curve, andHandle_Poly_Triangulationin the generated CXX boundary.On MSVC, those names resolve to OCCT compatibility classes emitted by
DEFINE_STANDARD_HANDLE, while the wrapper allocatesopencascade::handle<T>. The resulting distinct types make wrapper return values incompatible with CXX's generated signatures. This change gives all 16 wrapper-owned handle types one private C++ naming convention that cannot collide with OCCT, without changing their Rust names or high-level API.Reproduction
At upstream
d114250a464d50cde1901743d3bf523a099d6887, a cleancargo check -p opencascadewith the defaultbuiltinfeature, Rust 1.97.1, CMake 4.4.2, and MSVC 14.51 reachesopencascade-sysand fails with:CMAKE_POLICY_VERSION_MINIMUM=3.5was set because the local validation used CMake 4.4.2. The Windows CI step scopes the same compatibility setting to its bundled-OCCT compile.Validation
cargo check -p opencascadewith bundled OCCT on Windows/MSVC 14.51: passedcargo clippy --all-targets -- -D warnings: passedcargo fmt --all -- --check: passedcargo test -p opencascade-sys -p opencascade: bridge compilation passed, but Windows test executables hit an existing unresolvedadvapi32linkage (SetFileSecurityW,AddAce, and related symbols)The added Windows job intentionally uses
cargo check, which compiles every split CXX bridge and the high-level crate without being blocked by that unrelated test-link issue. Existing Linux test coverage is unchanged.