Repository navigation
Keep the delay-load failure hook in static builds - #142
Merged
Merged
Conversation
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.
A static link drops
delayimp.cpp. Nothing refers to__pfnDliFailureHook2, so the linker never pulls that object in, and the program ends up with no delay-load failure hook. When a delay-loaded screen reader DLL is missing, the helper raises instead of taking prism's stub, and the process dies.On a machine without PC-Talker, a statically linked program that initializes that backend:
0xc06d007eis the delay-load helper's "module not found" exception. The same program linked againstprism.dllgetsPRISM_ERROR_BACKEND_NOT_AVAILABLE, because the hook sits inside the DLL. The static library does carry the object:prism.libholds bothdelayimpand__pfnDliFailureHook2, and the linked executable holds neither.What this does
delayimp.cppemitsprism_anchor_delayimp, andprism.cppnames it in a/include:directive, the waybackend_anchors.hkeeps the backend registrars. MSVC only, with the leading underscore on x86.Testing
Windows x64 and x86, from a Rust program that creates every registered backend and calls
initializeon each, on a machine with NVDA running and no other screen reader installed.Before, statically linked, x64:
After, statically linked, x64 and x86, and linked against
prism.dllas before: