Earlier quoted context omitted.
im too much of a mac user to understand what this references :p
Take a random Linux binary which does anything non-trivial (has a GUI, does system monitoring, etc.), try running it on a different distribution from 3 years earlier without a packaging system, and tell me how it goes.
Windows: Prefer the Native API over Win32
71–80 of 99 posts
Re: Windows: Prefer the Native API over Win32
#72Earlier quoted context omitted.
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.
Is there a source for this? My Google- and GitHub-fu turns up nothing.
Re: Windows: Prefer the Native API over Win32
#73Earlier quoted context omitted.
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.
Are you talking about the cipher tests that are run when any cipher library is loaded? There's a reason they do that and it's not for shits and giggles. You could find yourself with broken ciphers and not know it. Skipping the cipher (or hash - not sure now) tests seem like a good way to get exploited.
Re: Windows: Prefer the Native API over Win32
#74Fool's errand. Apps built with this will have to be maintained forever (vs the apps from Win 9x which still work in Windows 11).
The reason apps from Win 9x runs on Windows 11 is that MS puts a ton of effort into explicitly supporting old apps. For popular apps that includes supporting undocumented APIs and even app-specific bug compatibility. Putting it on app developers to account for infinite forward compatibility is not at all reasonable. The best outcome would be if many Zig apps become popular enough that Windows is forced to maintain ba…
No, that's one of the reasons. The other one is that public kernel32 -> private ntdll design works.
Re: Windows: Prefer the Native API over Win32
#75Earlier quoted context omitted.
Statistically notable improvement, but it didn't help a whole lot.
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.
Re: Windows: Prefer the Native API over Win32
#76> 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. Zi…
The Zig maintainers clearly think that keeping up with the undocumented native API is less headache than using the documented but notoriously inelegant win32 API. This might very well be a good idea. Microsoft is not going to change a vital piece of their OS just on a whim. I would wager that even if they wanted to, they would not be able to do so that easily. A large organization maintaining a large software with a…
Re: Windows: Prefer the Native API over Win32
#77I'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 exce…
Re: Windows: Prefer the Native API over Win32
#78Earlier quoted context omitted.
> 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
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.
Re: Windows: Prefer the Native API over Win32
#79Earlier quoted context omitted.
> 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.
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.
Funny that you would be arguing for that (unless I misunderstood the intention), given your many other posts about how C is a horrible broken unsafe language that should not be used by anyone ever. I tend to agree with that, btw, even if not so much with the "memory safety" hysteria.
Should every program, now and in the future, be forced to depend on libc, just because it's "grandfathered in"?
IMO, Linux is superior because you are in fact free to ignore libc, and directly interface with the kernel. Which is of course also written in C, but that's still one less layer of crud. Syscalls returning error codes directly instead of putting them into a thread-local variable would be one example of that.
Should a hypothetical future OS written in Rust (or Ada, ALGOL-68, BLISS, ...) implement its own libc and force userspace appplications to go through it, just because that's "proper"?
Re: Windows: Prefer the Native API over Win32
#80Earlier quoted context omitted.
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.
But is the "proper UNIX way" a good thing? Funny that you would be arguing for that (unless I misunderstood the intention), given your many other posts about how C is a horrible broken unsafe language that should not be used by anyone ever. I tend to agree with that, btw, even if not so much with the "memory safety" hysteria. Should every program, now and in the future, be forced to depend on libc, just because it's…