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

Make riddle available as a library #2609

Merged
merged 7 commits into from
Aug 15, 2023
Merged

Make riddle available as a library #2609

merged 7 commits into from
Aug 15, 2023

Conversation

kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Aug 15, 2023

This update makes the riddle tool available as a library crate.

  • I've repurposed the windows-bindgen crate rather than minting yet another crate.
  • The "default" metadata is now included by the windows-bindgen crate directly. This can be turned off using default-features = false as the riddle tool does.
  • The tool_core crate used internally by windows-rs illustrates how to use windows-bindgen as a library (9b17c65).
  • The interface is the same between riddle and windows-bindgen namely string arguments. The choice is thus purely whether you need a library or prefer a command line tool.

@ChrisDenton does this improve your developer experience?

The rest of the PR has a lot of noise but that's largely just generated comments getting updated/removed.

Fixes: #2593
Fixes: #2607

@kennykerr
Copy link
Collaborator Author

Ideally you can just pass library/std/src/sys/windows/c/windows_sys.lst directly to windows-bindgen. 😊

@ChrisDenton
Copy link
Collaborator

ChrisDenton commented Aug 15, 2023

I had a brief look and, yep, this looks easier to integrate. I'll do a draft PR to rust-lang tomorrow and see if anything shakes out (iirc there have also been quite a few changes since the last metadata update).

Ideally you can just pass library/std/src/sys/windows/c/windows_sys.lst directly to windows-bindgen. 😊

Slightly tricky atm because we have comments in the windows_sys.lst file. And we add a few bits to the output file too (mostly just to make arm32 not be a compile error),

@kennykerr
Copy link
Collaborator Author

Sounds good. Let me know if you need me to tweak anything. I can also skip comments if that's the only obstacle.

@kennykerr kennykerr merged commit f1b1edd into master Aug 15, 2023
@kennykerr kennykerr deleted the bindgen branch August 15, 2023 21:01
@ChrisDenton
Copy link
Collaborator

Yeah, I think the comments are the only issue with input.

I did notice that FindFirstFileW is returning a HANDLE type instead of a FindFileHandle. Was that intentional?

Also minor thing but I think it'd be good to remove the std special case for SOCKET. It should now be easy to use the windows-sys type internally.

@kennykerr
Copy link
Collaborator Author

The FindFirstFileW thing probably flipped around in the Win32 metadata. I can't point to a commit or PR as they don't have a good way of tracking changes. I'm planning on stabilizing that as soon as I have a few more pieces in place for riddle. Sorry about that. For what it's worth, I think HANDLE is correct.

I'll have a PR up tomorrow with the changes for stripping comments and removing the specializations. You can then double check that for me. Be great to have less differences.

@ChrisDenton
Copy link
Collaborator

The FindFirstFileW thing probably flipped around in the Win32 metadata. I can't point to a commit or PR as they don't have a good way of tracking changes. I'm planning on stabilizing that as soon as I have a few more pieces in place for riddle. Sorry about that. For what it's worth, I think HANDLE is correct.

Tbh it ultimately doesn't matter for sys style bindings, other than making the diff nicer, I was more curious.

Be great to have less differences.

Yep! I hope to continue pecking away at the differences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants