Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed handleapi feature link library from kernel32 to WindowsApp to… #782

Closed
wants to merge 1 commit into from
Closed

Changed handleapi feature link library from kernel32 to WindowsApp to… #782

wants to merge 1 commit into from

Conversation

angelortiz1007
Copy link

While doing builds of ipc-channel and using windows 10 api CompareObjectHandles() I received an unresolved message for CompareObjectHandles().

Reading Microsoft link: https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis I changed build.rs, handleapi link time library from kernel32 to WindowsApp.

After testing locally on my ipc-channel build and using my patched winapi v0.3.0 I removed the link time unresolved error and all ipc-channel tests passed.

… address/fix #781.

@jdm jdm mentioned this pull request Jul 4, 2019
@retep998
Copy link
Owner

retep998 commented Jul 17, 2019

If WindowsApp.lib were linked to, depending on order in the linker many functions will end up resolving to various api-ms-win-core dlls rather than older dlls. For example GetLocalTime could end up coming from api-ms-win-core-sysinfo-l1-1-0.dll instead of kernel32.dll. This will absolutely break support for older Windows that do not have the api-ms-win-core dlls such as Windows 7.

If we had the raw-dylib feature then this would be a much easier problem to solve but unfortunately we won't for a long time.

I'm not entirely sure how to solve this issue, and for now my recommendation is to just load the function via GetProcAddress or a crate that wraps that.

@jdm
Copy link
Contributor

jdm commented Jul 17, 2019

Good to know that that's a possible workaround. Thanks!

@angelortiz1007
Copy link
Author

The LoadLibrary() of api-ms-win-core-sysinfo-l1-1-0.dll followed by GetProcAddress() should work.

Obviously, if ipc-channel - which uses CompareObjectHandles() - is mondified to use LoadLibrary()/GetProcAddress() 1 test will still fail if ipc-channel is used on non-windows 10 systems.

@retep998 retep998 added the blocked by rust Blocked on a feature being implemented or bug being fixed in Rust label Aug 28, 2019
@retep998
Copy link
Owner

Because this leads to other undesired changes, this PR cannot be merged.

@retep998 retep998 closed this Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked by rust Blocked on a feature being implemented or bug being fixed in Rust
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Link error with CompareObjectHandles
3 participants