Re:Zig Build System
by richardwhiuk on Friday April 14, 2023 @06:46AM
(#35567898)
It adds a new dependency - the c language frontend - aka clang - surely the zig compiler emits LLVM IR, not C code?
[ Parent
| on HN ]
Re:Zig Build System
by daurnimator on Friday April 14, 2023 @07:15AM
(#35568128)
zig supports importing C headers via the special built-in `@cImport`. That feature requires a C language front end to operate.
https://ziglang.org/documentation/0.10.1/#Import-from-C-Head...
Re:Zig Build System
by tristan957 on Friday April 14, 2023 @12:17PM
(#35571235)
Zig has a C backend that supports something like 99% of all Zig if I'm remembering the number correctly.
Zig has almost completely solved the bootstrap problem.
Re:Zig Build System
by trashburger on Friday April 14, 2023 @01:26PM
(#35572140)
This isn't quite correct. Yes, it can output C code; however the result is not very readable at all, and fails the DFSG on generated code. It _is_ useful for compiling Zig code to targets which aren't supported by LLVM, however.
Do you have a reference for this? Does it use a C backend that is part of LLVM, or is it something Zig-specific? What are its limitations? Can it compile libraries to C, or only entire applications?
I have wanted Rust and Zig to support compile-to-C for a while, so this is exciting news for me.
One thing that would particularly interest me is if functions intended to be inlined could be emitted into .h files.