Repository navigation
ws2_offline: gta6rt links again without ws2_32 (RT-WS2-OFFLINE-LINK) - #2597
Merged
Merged
Conversation
…s without ws2_32 wrap_extension_lookup (ProjectLeonida#2533) called WSAGetLastError directly. gta6rt does not link ws2_32 (only ws2_offline_test does), so the MSVC link of gta6rt.exe failed with LNK2019 __imp_WSAGetLastError. The shim reaches the host's Winsock through host_proc everywhere else; wsa_last_error does the same, mirroring set_wsa_error, with GetLastError as the fallback. gta6rt.exe imports the same DLLs as before ProjectLeonida#2533, no WS2_32. Co-authored-by: Tyrannys <80750971+Tyrannys@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Merged to unbreak the AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes. |
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.
Item: RT-WS2-OFFLINE-LINK (claim: #2570 (comment))
Follows #2533 (fixes its Windows link failure), asked by @MoonEyes. Co-authored with @Tyrannys, the author of #2533.
What broke. Since #2533,
gta6rt.exeno longer links with MSVC on Windows:ws2_offline.cpp.obj : error LNK2019: unresolved external symbol __imp_WSAGetLastErrorinrt::ws2::(anon)::wrap_extension_lookup.Why.
wrap_extension_lookupcallsWSAGetLastError()directly.gta6rtdoes not linkws2_32, and that isdeliberate: the runtime keeps networking offline. Only
ws2_offline_testlinks it, so the test target built andthe runtime did not. Everywhere else, the shim reaches the host's Winsock through
host_proc(
LoadLibraryExW+GetProcAddress). That includesset_wsa_errorand theWSAGetLastErrorthatbind_loopback_if_unboundresolves itself.Fix. A
wsa_last_error()helper next toset_wsa_errorresolvesWSAGetLastErrorthroughhost_proc. If thatfails, it falls back to
GetLastError(on Windows, Winsock's error is the thread's last-error value).wrap_extension_lookupuses the helper. No new import and no CMake change.Tests (RTX 4070 Laptop, Windows 11, MSVC 2022 BuildTools, Ninja, RelWithDebInfo,
LEONIDA_REQUIRE_VULKAN=ON):gta6rtandws2_offline_testbuild and link.dumpbin /imports gta6rt.exegives the same DLL list as a build of the previous main (1bc055e, before ws2_offline: refuse the local computer's name, answer localhost with loopback literals, keep WSAIoctl synchronous (RT-WS2-OFFLINE-LOOKUP-LEAKS) #2533).Neither list has
WS2_32.dll.ctest -R "^ws2_offline$"passed (1/1).AI-assisted (Claude Code, Claude Opus 5.5).
🤖 Generated with Claude Code