Windows: Prefer the Native API over Win32
3 months ago
- #Windows
- #Zig
- #NativeAPI
- Zig prefers using Native APIs (ntdll.dll) over Win32 APIs (kernel32.dll) for performance and power reasons.
- Native APIs provide richer error handling via NTSTATUS, better time resolution, and more granular control over kernel objects.
- Not all Win32 APIs will be replaced; complex or undocumented ones like console APIs and networking will remain.
- Using Native APIs can bypass some Windows compatibility layers, but this is considered acceptable for Zig's goals.
- Backward compatibility is not a primary concern; Zig targets Windows 10/11 and their server variants.
- Potential issues with Wine or anti-virus software are acknowledged but not seen as significant blockers.
- Contributors are encouraged to help replace Win32 APIs with Native ones where feasible.