Build System Reworked
The article discusses the advantages of bypassing kernel32.dll in favor of using ntdll.dll for Windows API calls. It highlights the inefficiencies and potential issues introduced by the kernel32 wrappers, particularly in terms of resource allocation and error handling. The author provides examples demonstrating how using the native API can lead to better performance and reliability in software development.
- ▪The Zig standard library aims to prefer the native API over Win32 to avoid unnecessary overhead.
- ▪Using ntdll.dll can eliminate issues like dynamic DLL loading and unpredictable failures in random byte generation.
- ▪The article contrasts the error handling of ReadFile and NtReadFile, showing the benefits of returning error codes directly.
Opening excerpt (first ~120 words) tap to expand
February 03, 2026 Bypassing Kernel32.dll for Fun and Nonprofit Author: Andrew KelleyThe Windows operating system provides a large ABI surface area for doing things in the kernel. However, not all ABIs are created equally. As Casey Muratori points out in his lecture, The Only Unbreakable Law, the organizational structure of software development teams has a direct impact on the structure of the software they produce.The DLLs on Windows are organized into a heirarchy, with some of the APIs being high-level wrappers around lower-level ones. For example, whenever you call functions of kernel32.dll, ultimately, the actual work is done by ntdll.dll.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at Ziglang.