Repository navigation
rust/obs-util: Declare the pipe-windows Win32 calls directly (fix Windows Rust-ON link) - #261
Merged
Merged
Conversation
obs-rust#259 merged with the core taking its Win32 calls from windows-sys 0.61, which links through windows-link's raw-dylib import records. std imports api-ms-win-core-synch-l1-2-0 the same way, and libobs links libobs_rust.lib with WHOLEARCHIVE, so obs.dll gets both records and the Windows ENABLE_RUST_LIBOBS=ON build fails: libobs_rust.lib(api-ms-win-core-synch-l1-2-0.dll) : error LNK2005: __IMPORT_DESCRIPTOR_api-ms-win-core-synch-l1-2-0 already defined obs.dll : fatal error LNK1169 The module now declares its ten kernel32 functions and three structs itself, against kernel32.lib like ffi::bmem declares malloc, with size checks against the SDK, and obs-util no longer depends on windows-sys. Behavior is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
7 of 11 tasks
Member
|
Thanks, this is option 1, and the branch is already on current master.
|
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.
Fixes the Windows
ENABLE_RUST_LIBOBS=ONlink on master since #259:#259 merged at
306ec7aba, which still took its Win32 calls fromwindows-sys0.61. The fix below was pushed to that branch a few minutes after the merge, so it never reached master.Change
This is option 1 from @zackees's diagnosis on #259.
windows-syslinks throughwindows-link'sraw-dylibimport records, andstdimportsapi-ms-win-core-synch-l1-2-0the same way. Because libobs linkslibobs_rust.libwithWHOLEARCHIVE, both records land inobs.dll.obs_util::pipe::windowsnow declares its tenkernel32functions (CreatePipe,SetHandleInformation,CreateProcessW,WaitForSingleObject,GetExitCodeProcess,ReadFile,WriteFile,CloseHandle,GetLastError,MultiByteToWideChar) and three structs (SECURITY_ATTRIBUTES,STARTUPINFOW,PROCESS_INFORMATION) itself, againstkernel32.lib, likeffi::bmemdeclaresmalloc. Compile-time asserts check the struct sizes against the SDK for 64-bit and 32-bit targets. obs-util no longer depends onwindows-sys, soCargo.lockloses that edge. Behavior is unchanged.Testing (Windows, MSVC)
/WHOLEARCHIVE:libobs_rust.lib: thewindows-sysbuild gives the sameLNK2005/LNK1169; this build links.test_pipe.cagainst thislibobs_rust.lib: 14/14.pipe18/18,pipe_parity10/10,export_list3/3.-D warningsandcargo fmt --checkare clean.Windows Tier 2 CI is the real check.
🤖 Generated with Claude Code