v0.25.0 is not working on Windows 8.1
Opened this issue ยท 6 comments
What steps will reproduce the bug?
- Download bat from GitHub Releases
- Run bat in cmder
What happens?
An error box is prompted:
The procedure entry point CompareObjectHandles could not be located in the dynamic link library C:\Users\User\Downloads\bat-v0.25.0-x86_64-pc-windows-msvc\bat.exe.
What did you expect to happen instead?
No error occurs.
How did you install bat?
GitHub Release
bat version and environment
0.25.0 doesn't work, but 0.24.0 works.
OS: Windows 8.1 x64
Does the error also occur when you start bat with --theme=dark?
Context: I know that one of the dependencies that I authored (terminal-trx) uses CompareObjectHandles. --theme=dark turns off automatic color scheme detection which means terminal-trx never gets called :)
@bash The error still occurs when starting bat with --theme=dark:
I don't typically do Windows development, so I'm not too familiar with searching through Microsoft's documentation, but from what I can tell it looks like Windows will try to resolve all the imports at the time an image is loaded. Maybe that's why @bash's suggestion isn't working?
That explanation makes a lot of sense, thanks :) It also explains why bat --help fails too :D
I quickly built bat with a patched version of terminal-trx where I stubbed out the call to CompareObjectHandles and bat indeed then works on Windows 8.1.
I don't have any capacity to dig into this further but I'd happily accept a PR on the terminal-trx side if someone is up for that ๐
If CompareObjectHandles doesn't have any alternatives compatible with Windows 8, I think the solution would be to try to lazy-load/resolve the function and return an error if it can't be resolved.
There is actually a Delay-Load Import Table in the PE file format that can be used with a linker flag. It's per DLL rather than per symbol, though, and that's probably not too helpful here since CompareObjectHandles comes from Kernelbase.dll.
I don't quite have the capacity to experiment with it either, but if someone else wants a fun "here be unsafe dragons" challenge, LoadModule and GetProcAddress can probably be used to import the function at runtime.
Until that happens, bat has a couple of options:
- Windows 10 could be the minimum supported version.
- There could be a build feature for Windows versions < 10, disabling color detection. Users on Windows 8.1 would have to build
batthemselves, but it would still work.
https://en.wikipedia.org/wiki/Windows_8.1
Mainstream support for Windows 8.1 ended on January 9, 2018, and extended support ended on January 10, 2023
I personally think it would be reasonable for bat to support Windows 10 as a minimum

