Skip to content

change Windows DLL loading to more modern "altered" search - #5591

Open
mflatt wants to merge 1 commit into
racket:masterfrom
mflatt:load-library-ex
Open

mflatt wants to merge 1 commit into
racket:masterfrom
mflatt:load-library-ex

Conversation

@mflatt

@mflatt mflatt commented Sep 26, 2026

Copy link
Copy Markdown
Member

Along lines suggested by @ndykman, change DLL loading to look for dependencies alongside a loaded DLL, instead of looking in the executable directory (while other parts of the search path are unchanged).

This is a more conservative change than the suggested one, but I think it gets at the main goal in a way that's directly provided by the OS. It's still a change from Racket's previous behavior, but the limited change seems more likely to solve problems than create them. For example, the ffi2 documentation's example can work on Windows with only small changes.

Note that ffi-lib will still find an immediately requested DLL adjacent to the executable, since the executable serves as the relevant module in that case. The difference is in looking for dependencies of a DLL. If dependencies are meant to be found adjacent to the executable, there's a good change that the immediately requested DLL was there, too, and it's no change in that case.

mflatt added a commit to mflatt/racket that referenced this pull request Sep 26, 2026
The advice to use `cairo` instead of `libcairo` is not enough, yet,
but that advice will become right if we change DLL loading on Windows
(possibly via racket#5591). Meanwhile, document rendering will not crash.
mflatt added a commit that referenced this pull request Sep 26, 2026
The advice to use `cairo` instead of `libcairo` is not enough, yet,
but that advice will become right if we change DLL loading on Windows
(possibly via #5591). Meanwhile, document rendering will not crash.
Along lines suggested by @ndykman, change DLL loading to look for
dependencies alongside a loaded DLL, insead of looking in the
executable directory (while other parts of the search path are
unchanged).

This is a change from previous behavior, but seems more likely to
solve problems than create them. For example, the `ffi2` example
can work on Windows with only small changes.
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.

1 participant