Windows: Support for UCRT? #619
Labels
No labels
3rdparty
Android
API
Author does not respond
bsd
bug
build system/CI
ci-virtual-device
CMake
Contributions Welcome
Core
dependencies
device-specific
documentation
don't_merge
duplicate
enhancement
Example
Haiku
hidraw
hotplug
info required
invalid
libusb
macOS
Misc
Not an issue
question
Release
Test
Test GUI
Windows
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libusb/hidapi#619
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In the last few years more recent builds of Windows 10 have gained better and better support for UTF8. It may be possible to switch to the char based APIs for the Windows backend and switch to linking to UCRT as well. This would, in theory, enable for more code to be reused between the Windows backend and POSIX systems.
If this were to be done, we could probably also switch to using char strings exclusively in the public API of
hidapi. I found it strangehidapieven uses wide characters, and I assume it is related to the Windows backend.Lets separate the two things: switching from
wchar_ttocharin the public API and switching fromCRTtoUCRTfor Windows backend. Those are totally independent things.Stop using
wchar_tin the public API - I like that idea very much, and that is something for v1 for sure. That is a huge backward incompatible API change and I don't see it happening any time soon. It does not require usingUCRT- the legacyCRTlibrary still can be used with that just fine.As for using/switching to
UCRT- I don't have a strong oppinion as I haven't used it myself yet. What I'm sure is that it would complicate deployement for some users, specially for those who still need Windows7 support. And it would require some efforts to fix something that is not broken as of yet.Now regarding re-using code. There'are 4 different backends, not just Windows and POSIX. The only code that can really be re-used is mostly not related too strigns conversions (e.g. hid_enumerate or hid_error). Most of other code is platform-specific and won't be re-used anyway.
There're mostly legacy reasons for that - Alan Ott chose to use it at the time and we can't "just change" it as of this moment.
I guess his motivation was the fact that most HID devices are USB HID devices, and by USB standard - strings are
UTF16-LEcharacters which are easier to convert towchar_tthan to anything else. Note that the initial API was designed back in 2010 - UTF8 wasn't as widely popular back then.