RDL introduced a lot of type inconsistencies
Author: sylveonCreated Sep 20, 2026Updated Sep 23, 2026
Labelsquestion
Summary
The switch to RDL from win32-metadata is a... painful one for downstream consumers of windows-rs, with a lot of changes. One of them is the new creation of inconsistencies between functions and their associated constants. For example, to list the ones that came up so far when migrating my code:
SetConsoleCtrlHandler's callback takes a parameter of typeu32, but the associated constants likeCTRL_C_EVENTarei32GetLastError/SetLastErrortake and return anu32while all error constants arei32SetWinEventHook'sdwFlagsparameter is of typeu32, but the named constants are of typei32
Having to constantly do these as casts is annoying, pointless and makes it harder to concentrate on actual logic. For example, the samples and windows-rs crates have code like WIN32_ERROR(ERROR_INVALID_DATA as u32), which really should just be WIN32_ERROR(ERROR_INVALID_DATA).
Crate manifest
Crate code
Source: microsoft/windows-rs