frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Windows: Prefer the Native API over Win32

https://codeberg.org/ziglang/zig/issues/31131
57•nikbackm•4d ago

Comments

pseudohadamard•3d ago
For people not familiar with Windows development, another name for the NT native API is "the API that pretty much every document on Windows programming tells you not to use". It's like coding to the Linux syscall interface instead of libc.
nullpoint420•1h ago
Yeah, I know go has had issues because they subvert libc themselves in similar fashion. I wonder how this will turn out.
LoganDark•1h ago
I think they had to revert back to libc on macOS/iOS because those have syscall interfaces that truly are not stable (and golang found that out the hard way). I wonder if they had to do the same on BSDs because of syscall filtering.
wrs•1h ago
Go backed out of their strategy on MacOS and started using libc (libsystem?), because when Apple says something is internal and may change without notice, they really mean it. It may be a better risk with Microsoft, but it’s still a risk.
HexDecOctBin•1h ago
Linux syscall interface is actually stable and can easily be targeted. It’s BSDs (and Mac OS) that force everyone to link to only libc.
pjmlp•1h ago
More like everyone else, Linux kernel is the exception here.
kvemkon•1h ago
> It's like ...

Considering the level of the API. But it is total opposite comparing a bit deeper. Linux has a famous rule "WE DO NOT BREAK USERSPACE!" e.g. [1].

[1] https://news.ycombinator.com/item?id=44611692

dunder_cat•1h ago
One thing that is amusing about the prevalence of advanced anti-cheat in Windows gaming is it's actually causing said API/ABIs to undergo ossification. A good data point is the invention of Syscall User Dispatch^1 on Linux which would allow a program to basically install a syscall handler when they originate from various regions of memory. I do not know how usable this is in practice, admittedly -- but I think the fact it was contributed at all speaks to the growing need.

^1 https://docs.kernel.org/admin-guide/syscall-user-dispatch.ht...

koakuma-chan•1h ago
> It's like coding to the Linux syscall interface instead of libc.

The right thing to do? I don't see why I would want to use libc.

delta_p_delta_x•1h ago
On Windows, the stability guarantees are opposite to that of Linux. The kernel ABI is not guaranteed to be stable, whereas the Win32 ABI is.

And frankly, the Windows way is better. On Linux, the 'ABI' for nearly all user-mode programs is not the kernel's ABI but rather glibc's (plus the variety of third-party libraries, because Win32 has a massive surface area and is an all-in-one API). Now, glibc's ABI constantly changes, so linking against a newer glibc (almost certainly the 'host' glibc, because it is almost impossible to supply a different 'target' glibc without Docker) will result in a program that doesn't run on older glibc. So much for Torvalds' 'don't break userspace'.

Not so for a program compiled for 'newer' Win32; all that matters are API compatibilities. If one only uses old-hat interfaces that are documented to be present on Windows 2000, one can write and compile one's code on Windows 11, and the executable will run on the former with no issues. And vice versa, actually.

monocasa•58m ago
A lot of the native API is considered stable these days. The actual signals aren't, but the wrappers in ntdll are.
pjmlp•58m ago
Nope, in UNIX proper syscalls and libc overlap, that is how C and UNIX eventually evolved side by side, in a way one could argue UNIX is C's runtime, and hence why most C deployments also expect some level of compatibility with UNIX/POSIX.

Linux is the exception offering its guts to userspace with guarantees of stability.

usrnm•57m ago
> I don't see why I would want to use libc

To make your code portable? Linux-only software is even worse than Windows-only

koakuma-chan•23m ago
Let me narrow down the scope here. I am a Rust developer, developing software that will run on my Linux server. Why would I want to use libc? Why does Rust standard library use libc? Zig, for example, doesn't.
pjmlp•1h ago
Except unlike Linux syscall interface and like almost every other OS out there, ABI compatibility is an accident, not a guarantee.
eps•26m ago
"Every document" notwithstanding, Native API is very widely used in practice and generally considered stable.

If in doubt, try and find examples of its breakage, semantic changes, etc.

lostmsu•1h ago
Fool's errand. Apps built with this will have to be maintained forever (vs the apps from Win 9x which still work in Windows 11).
roelschroeven•1h ago
> > Won't this get flagged by anti-virus scanners as suspicious?

> Unfortunately, yes. We consider this a problem for the anti-virus scanners to solve.

I don't think the anti-virus scanners consider Zig important enough, or even know about. They will not be the ones experiencing problems. Having executables quarantined and similar problems will fall on Zig developers and users of their software. That seems like a major drawback for using Zig.

monocasa•1h ago
Yeah, I had this problem when shipping go binaries on Windows. Antivirus vendors really do not care that your program regularly shows up as a false positive due to their crappy heuristics, even if you have millions of users.
anfragment•1h ago
Have you tried code-signing with an EV certificate? If so, did it help? Asking for a friend.
monocasa•56m ago
Statistically notable improvement, but it didn't help a whole lot.
yndoendo•55s ago
I always upload a copy to https://www.virustotal.com to help combat the false positives.

It was really bad a couple years ago because anything wrapped in Inno Setup kept being flagged. Now maybe one or two flag vendors do; Bkav Pro and CrowdStrike Falcon are the dominate culprits always.

dleslie•9m ago
Yup. This sentiment expresses quite clearly how Zig has no significant understanding or interest in being a language used for widely distributed applications, like video games.

There's no way I can ship a binary that flags the scanners. This wouldn't be the first language I've avoided because it has this unfortunate behaviour.

And expecting virus scanner developers to relax their rules for Zig is a bit arrogant. Some virus scanners started flagging software built with Nim simply because Nim became popular with virus authors as a means to thwart scanners!

slopinthebag•3m ago
>> Unfortunately, yes. We consider this a problem for the anti-virus scanners to solve.

In reality it will be a problem for the developers to solve, and the solution will be to use a different language lol

cmovq•1h ago
Is there an official stance on whether ntdll is stable? Obviously they're not going to change things arbitrarily since applications depend on it, but I'm wondering if there is a guarantee like the linux syscall interface or how you can run a win32 application compiled in 2004 on Win11.
monocasa•1h ago
It's partially stable.

Basically any thing documented on msdn in the API docs is considered stable.

Such as: https://learn.microsoft.com/en-us/windows/win32/api/winternl...

delta_p_delta_x•56m ago
Indeed. Anything documented has a function wrapper. `NtCreateFile` is a function wrapper for the syscall number, so any user-mode code that has `NtCreateFile` instead of directly loading the syscall number 0x55 will be stable. The latter might not. In fact, it is not; the number has increased by 3 since Windows XP[1].

One could probably produce some sort of function pointer loader library with these tables, but at that point... Why not just use the documented APIs?

[1]: https://github.com/j00ru/windows-syscalls/blob/8a6806ac91486...

cmovq•55m ago
Interesting, some functions explicitly mention:

> [NtQuerySystemTime may be altered or unavailable in future versions of Windows. Applications should use the GetSystemTimeAsFileTime function.] [0]

So it does seem like a bad idea for a standard library.

[0]: https://learn.microsoft.com/en-us/windows/win32/api/winternl...

bob1029•1h ago
Why not use both DLLs? Prefer win32 wherever possible and use the lower level APIs only if absolutely necessary. Benchmark after you have figured this out. Performance is probably not a thing at this level of abstraction.
nvme0n1p1•36m ago
What makes you think they haven't benchmarked?

Here's one fun example from following development on Zulip: advapi.dll loads bcrypt.dll, which loads bcryptprimitives.dll. bcryptprimitives.dll runs an internal test suite every time it's loaded into any process. So if you can avoid loading advapi.dll, your process will start faster.

delta_p_delta_x•57s ago
[delayed]
dblohm7•53m ago
This is a terrible idea! _Maybe_, _maybe_ using only the documented APIs with only the documented parameters.

Unfortunately it makes too many false assumptions about interoperability between Win32 and the underlying native API that aren't true.

For example (and the Go runtime does this, much to my chagrin), querying the OS version via the native API always gives you "accurate" version information without needing to link a manifest into your application. Unfortunately that lack of manifest will still cause many Win32 APIs above the native layer to drop into a compatibility mode, creating a fundamental inconsistency between what the application thinks the OS capabilities are versus which Win32 subsystem behaviours the OS thinks it should be offering.

boje•48m ago
Honestly, this sounds like a future headache that would otherwise go unnoticed unless the programmer is dealing with porting or binding over source code meant for older Windows systems to Zig (or supporting older systems in general). Eventually it might result in a bunch of people typing out blogposts venting their frustrations, and the creation of tutorials and shims for hooking to Win32 instead of the Zig standard library with varying results. Which is fine, I suppose. Legacy compiler targets are a thing.

This is already a problem with Linux binaries for systems that don't have a recent enough Glibc (unless the binaries themselves don't link to it and do syscalls directly).

cmovq•40m ago
>> Microsoft are free to change the Native API at will, and you will be left holding both pieces when things break.

> [...] the worst case scenario is really mild: A new version of windows comes out, breaking ntdll compatibility. Zig project adds a fix to the std lib. Application developer recompiles their zig project from source, and ships an update to their users.

That assumes the application developer will continue to maintain it until the end of time.

Also "the fix" would mean developers wanting to support earlier Windows versions would need to use an older std library? Or is the library going to have runtime checks to see what Windows build its running on?

eps•33m ago
> Microsoft are free to change the Native API at will,...

But they won't, because if there is one thing that Microsoft has always been extremely good at and cared for is backward compatibility. And changing Native API will break a ton of existing software, because even though undocumented it is very widely used.

blibble•21m ago
you are confusing the ntdll interface (which is undocumented and subject to change), and win32 (which is stable, mostly)

they tell you not to use ntdll, and say they will change it whenever they want

and they have in the past

(they have had to moderate this policy with "containers", but it's still what they say)

chroma_zone•2m ago
Sounds like the iOS model: your app only exists as long as you are alive and able to pay $99/year. This mentality is a nightmare for software preservation.
self_awareness•27m ago
For me this is too much. I wish Zig all the best, but decisions like this make me want to jump off this sinking ship.
qq66•26m ago
> Comparing the comprehensive Win32 API reference against the incidentally documented Native APIs, its clear which one Microsoft would prefer you use. The native API is treated as an implementation detail, whilst core parts of Windows' backwards compatibility strategy are implemented in Windows subsystem.

> A general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.

Zig clearly doesn't actually care that much about building robust and reusable software if they're going to forgo Microsoft's decades-long backwards compatibility functionality for the dubious gains of using bare-metal APIs.

slopinthebag•2m ago
lately it feels like zig is attempting to speed run irrelevance. which is a shame.
advisedwang•19m ago
I'm really struggling to see the pros of this:

> Performance - using the native API bypasses the standard Windows API, thus removing a software layer, speeding things up.

But the article cites no bemchmarks

> Power - some capabilities are not provided by the standard Windows API, but are available with the native API.

Makes sense when you are doing something that needs that power, but that makes more sense as an exception to prefering win32 than a general reason to prefer native.

> Dependencies - using the native API removes dependencies on subsystem DLLs, creating potentially smaller, leaner executables.

Linking win32 is a miniscule cost. (unless you have a benchmark to show me...)

> Flexibility - in the early stages of Windows boot, native applications (those dependent on NtDll.dll only) can execute, while others cannot.

Is Zig being used for such applications? If so, why are the calls that the document says will be kept on win32 not an issue?

moogly•16m ago
Yikes. Are they going to rename the language to "cyg" also? Does not inspire confidence.
born-jre•13m ago
Don’t know about windows programming to give opinion but by the sentiment here maybe they should give dev to choose bashed on some comptime flag or sth and maintain two versions
bmacho•7m ago
> the worst case scenario is really mild: A new version of windows comes out, breaking ntdll compatibility. Zig project adds a fix to the std lib. Application developer recompiles their zig project from source, and ships an update to their users.

The ~only good thing that programmers have achieved in the past ~60 years has been Windows stability.

Create a popular programming language, and then make programs written in it not run on newer Windowses is just something else. I so hate this.

Was "robust, optimal and reusable" always "run an older Windows on your newer Windows to run Zig software"?

TazeTSchnitzel•6m ago
Go famously tried to bypass macOS's libc and directly use the underlying syscall ABI, which is unstable, and then a macOS update came out and broke everything, which taught them the error of their ways (https://github.com/golang/go/issues/17490). I wonder if this will happen to Zig too.

Tailscale Peer Relays is now generally available

https://tailscale.com/blog/peer-relays-ga
140•sz4kerto•1h ago•31 comments

Garment Notation Language: Formal descriptive language for clothing construction

https://github.com/khalildh/garment-notation
77•prathyvsh•2h ago•18 comments

Pocketbase lost its funding from FLOSS fund

https://github.com/pocketbase/pocketbase/discussions/7287
40•Onavo•2h ago•13 comments

Zero-day CSS: CVE-2026-2441 exists in the wild

https://chromereleases.googleblog.com/2026/02/stable-channel-update-for-desktop_13.html
132•idoxer•2h ago•57 comments

If you’re an LLM, please read this

https://annas-archive.li/blog/llms-txt.html
561•soheilpro•11h ago•258 comments

Show HN: VectorNest responsive web-based SVG editor

https://ekrsulov.github.io/vectornest/
41•ekrsulov•3h ago•11 comments

Activeloop (YC S18) Is Hiring Back End Engineer (Go)

https://app.dover.com/apply/Activeloop/72d0b3a7-7e86-46a8-9aff-b430ffe0b97f
1•davidbuniat•29m ago

Warren Buffett dumps $1.7B of Amazon stock

https://finbold.com/warren-buffett-dumps-1-7-billion-of-amazon-stock/
46•fauria•43m ago•33 comments

Cistercian Numbers

https://www.omniglot.com/language/numbers/cistercian-numbers.htm
21•debo_•2h ago•2 comments

Terminals should generate the 256-color palette

https://gist.github.com/jake-stewart/0a8ea46159a7da2c808e5be2177e1783
392•tosh•12h ago•148 comments

Arizona Bill Requires Age Verification for All Apps

https://reclaimthenet.org/arizona-bill-would-require-id-checks-to-use-a-weather-app
48•bilsbie•1h ago•16 comments

The true history of the Minotaur: what archaeology reveals

https://www.nationalgeographic.fr/histoire/la-veritable-histoire-du-minotaure-ce-que-revele-arche...
10•joebig•2d ago•5 comments

Show HN: Formally verified FPGA watchdog for AM broadcast in unmanned tunnels

https://github.com/Park07/amradio
33•anonymoosestdnt•3h ago•6 comments

Show HN: CEL by Example

https://celbyexample.com/
45•bufbuild•4h ago•18 comments

Native FreeBSD Kerberos/LDAP with FreeIPA/IDM

https://vermaden.wordpress.com/2026/02/18/native-freebsd-kerberos-ldap-with-freeipa-idm/
87•vermaden•8h ago•39 comments

The only moat left is money?

https://elliotbonneville.com/the-only-moat-left-is-money/
111•elliotbnvl•2h ago•145 comments

AVX2 is slower than SSE2-4.x under Windows ARM emulation

https://blogs.remobjects.com/2026/02/17/nerdsniped-windows-arm-emulation-performance/
82•vintagedave•4h ago•72 comments

Fastest Front End Tooling for Humans and AI

https://cpojer.net/posts/fastest-frontend-tooling
64•cpojer•6h ago•29 comments

Fei-Fei Li's World Labs raised $1B from A16Z, Nvidia to advance its world models

https://www.bloomberg.com/news/articles/2026-02-18/ai-pioneer-fei-fei-li-s-startup-world-labs-rai...
19•aanet•1h ago•5 comments

Show HN: I'm launching a LPFM radio station

https://www.kpbj.fm/
67•solomonb•22h ago•46 comments

Ask HN: Are there examples of 3D printing data onto physical surfaces?

30•catapart•4d ago•52 comments

Asahi Linux Progress Report: Linux 6.19

https://asahilinux.org/2026/02/progress-report-6-19/
316•mkurz•8h ago•110 comments

Microsoft says bug causes Copilot to summarize confidential emails

https://www.bleepingcomputer.com/news/microsoft/microsoft-says-bug-causes-copilot-to-summarize-co...
158•tablets•6h ago•48 comments

The Future of AI Software Development

https://martinfowler.com/fragments/2026-02-18.html
136•nthypes•2h ago•88 comments

A DuckDB-based metabase alternative

https://github.com/taleshape-com/shaper
145•wowi42•12h ago•34 comments

Chained Assignment in Python Bytecode

https://loriculus.org/blog/python-chained-assignment/
17•wenderen•4d ago•13 comments

15 years later, Microsoft morged my diagram

https://nvie.com/posts/15-years-later/
889•cheeaun•12h ago•326 comments

TinyIce: Single-binary Icecast2-compatible server (auto-HTTPS, multi-tenant)

https://github.com/DatanoiseTV/tinyice
94•sylwester•12h ago•23 comments

Windows: Prefer the Native API over Win32

https://codeberg.org/ziglang/zig/issues/31131
57•nikbackm•4d ago•44 comments

Instruction decoding in the Intel 8087 floating-point chip

https://www.righto.com/2026/02/8087-instruction-decoding.html
52•pwg•4d ago•14 comments