3 ms·
To wit: https://ziglang.org/documentation/master/#extern-struct https://ziglang.org/documentation/master/#extern-struct > An extern struct has in-memory layout
by LexiMax 8mo ago
To wit: https://ziglang.org/documentation/master/#extern-struct https://ziglang.org/documentation/master/#extern-struct
> An extern struct has in-memory layout matching the C ABI for the target.
Zig is really good at speaking the C ABI of the target, but the upshot seems to be that it appears there is no stable Zig-native ABI.
If I'm correct, I wonder if there are plans to settle on a stable ABI at some point in the future. I do know that in other languages the lack of a stable ABI is brought up as a downside, and although I've been burned by C++ ABI stability too many times to agree, I can understand why people would want one.
- Cloudef 8mo agoI doubt zig will have stable abi any time soon. It may have some sort of "zig extern" when it gets mature. But stable abi isnt very usful if no-one else can talk it. I have project that uses codegen to effectively implement zig like ABI on top of the C abi. Heres the kind of code it generates https://zigbin.io/6dba68 https://zigbin.io/6dba68 It can also generate javascript, heres doom running on browser: https://cloudef.pw/sorvi/#doom.wasm https://cloudef.pw/sorvi/#doom.wasm
- peesem 8mo agoAndrew Kelley has said relatively recently that there are no plans to introduce a Zig ABI: https://github.com/ziglang/zig/issues/3786#issuecomment-2646658356 https://github.com/ziglang/zig/issues/3786#issuecomment-2646...