Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Switch from winapi to windows-rs #71

Open
senneh opened this issue Feb 13, 2023 · 6 comments
Open

Switch from winapi to windows-rs #71

senneh opened this issue Feb 13, 2023 · 6 comments

Comments

@senneh
Copy link

senneh commented Feb 13, 2023

The winapi crate hasn't been updated in over a year and has been deprecated by windows-rs which are the official rust bindings to the windows api.

I think it would be better to switch sooner rather than later.

One consideration would be whether to use the windows or windows-sys crate.

@xStrom
Copy link
Member

xStrom commented Feb 14, 2023

The API itself hasn't been updated even longer. We target APIs from a lot of years ago.

When I've previously looked at the windows crate it has been much more bloated than winapi. Slower compile times, larger binaries.

It does look like an eventuality of switching to windows. However unless there is an immediate benefit (e.g. using an API that isn't easily surfaced from winapi) or they have done a lot of optimization work recently, I don't think it's a good idea to do the switch right now. Especially if compile times suffer.

Is there any benefit in specific why you would like to switch sooner or is it because windows is the future?

@senneh
Copy link
Author

senneh commented Feb 14, 2023

Slower compile times, larger binaries.

Using the windows-sys crate is an option.

Is there any benefit in specific why you would like to switch sooner

Sure there is no immediate need, but it feels silly writing more code with winapi when it will have to be changed eventually.

@xStrom
Copy link
Member

xStrom commented Feb 15, 2023

it feels silly writing more code with winapi when it will have to be changed eventually

I can understand that. However I would like to point out that the windows crate API hasn't stabilized either. There is no guarantee that we won't have to rewrite some code anyway.

@waywardmonkeys
Copy link
Contributor

Might be worth pointing out that some configs already build windows, such as when accesskit is enabled. Of course other dependencies also use winapi ...

@waywardmonkeys
Copy link
Contributor

I've been peeking at this off and on and at this point have some amount of code converted, currently as a big ball of changes and not trying to do something piece by piece (which seems hard).

I can't compare build times until it is done, but so far, there's some nice reduction in code in parts of the Glazier code (and like I said before, when accesskit is enabled, we're building a fair bit of things anyway).

I'm saying this here so that 1) interested parties know and 2) interested parties don't start trying to do the same thing yet and duplicate any effort.

I'd started as I was looking at using some other APIs and found that they were exposed via windows / windows-sys ... and didn't feel like doing the extra work.

@waywardmonkeys
Copy link
Contributor

FWIW, now that I'm a couple of hours in, I'm probably going to toss it and switch to windows-sys .. at least experimentally.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants