TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Aro – Zig's new C compiler

221 pointsby whatever310 months ago

13 comments

AndyKelley10 months ago
I don't think it's accurate to call it "Zig's". This is an independent project started by Veikka Tuominen, a Zig core team member, but it's not owned or managed by ZSF in any way. It's Veikka's project. Don't take that away from him!
评论 #41022431 未加载
评论 #41025274 未加载
评论 #41021295 未加载
评论 #41019567 未加载
Jarred10 months ago
One of the features missing in bun:ffi is inferring types for symbols from header files. This would let you import C libraries in JavaScript&#x2F;TypeScript directly, without having to configure bindings.<p>We embed TinyCC for FFI, but TinyCC doesn&#x27;t expose a way to read the types for exported symbols.<p>Currently, it looks like this:<p><pre><code> import { dlopen, FFIType, suffix } from &quot;bun:ffi&quot;; &#x2F;&#x2F; `suffix` is either &quot;dylib&quot;, &quot;so&quot;, or &quot;dll&quot; depending on the platform &#x2F;&#x2F; you don&#x27;t have to use &quot;suffix&quot;, it&#x27;s just there for convenience const path = `libsqlite3.${suffix}`; const { symbols: { sqlite3_libversion, &#x2F;&#x2F; the function to call }, } = dlopen( path, &#x2F;&#x2F; a library name or file path { sqlite3_libversion: { &#x2F;&#x2F; no arguments, returns a string args: [], returns: FFIType.cstring, }, }, ); console.log(`SQLite 3 version: ${sqlite3_libversion()}`); </code></pre> It would be nicer if it was something like this:<p><pre><code> import {sqlite3_libversion as version} from &quot;sqlite3.h&quot; with {lib: &quot;sqlite3&quot;}; console.log(`SQLite 3 version: ${version()}`); </code></pre> Would love to use Aro to do this in the future
评论 #41022845 未加载
评论 #41022555 未加载
WalterBright10 months ago
The dlang D compiler includes a full C compiler, so you can mix and match C and D code. You can import C code from D, and D code from C.<p><pre><code> dmd hello.c .&#x2F;hello hello world </code></pre> This helps enormously in binding to existing C libraries.
评论 #41019030 未加载
评论 #41019223 未加载
评论 #41018542 未加载
评论 #41022194 未加载
评论 #41019385 未加载
评论 #41023568 未加载
评论 #41021576 未加载
livrem10 months ago
Is this part of the long-term plan for zig to get rid of the dependency on clang&#x2F;llvm?<p><a href="https:&#x2F;&#x2F;github.com&#x2F;ziglang&#x2F;zig&#x2F;issues&#x2F;16270">https:&#x2F;&#x2F;github.com&#x2F;ziglang&#x2F;zig&#x2F;issues&#x2F;16270</a>
评论 #41019534 未加载
评论 #41019057 未加载
slowmovintarget10 months ago
I&#x27;m not all that familiar with the Zig tool chain.<p>Am I understanding correctly that this is a regular C compiler used as a component of the Zig compiler chain allowing compilation of C files alongside Zig? Or does Zig generate C and therefore need a C compiler under the hood?<p>Looking at the documentation suggests it is the former, not the latter.
评论 #41018505 未加载
Y_Y10 months ago
It would be interesting to see how well it optimizes compared to the established players. The fact that it handles C23 and common GNU extensions is already impressive.
评论 #41018357 未加载
sirwhinesalot10 months ago
Very nice, honestly the tooling around Zig is even more impressive than the language itself.
评论 #41019106 未加载
lambdaone10 months ago
Zig is amazing. What started as a one-man project is becoming a mature software ecosystem capable of standing on its own as a peer with the major languages.
评论 #41019186 未加载
评论 #41019138 未加载
评论 #41019177 未加载
janice199910 months ago
There&#x27;s doesn&#x27;t appear to a whole lot of comments or documentation in the code. Is this normal for Zig projects? Does it have an equivalent of Sphinx to build docs from code?
评论 #41018478 未加载
评论 #41018439 未加载
fefe2310 months ago
Wait, so you still need zig, and zig still needs LLVM. If you have LLVM, you have clang.<p>What is the value proposition of this compiler, then?
评论 #41020663 未加载
评论 #41024267 未加载
ilayn10 months ago
I hope Zig adds complex numbers before it is too late. It&#x27;s a pity that they did not steal array syntax and slices from Fortran&#x2F;Numpy.
评论 #41023769 未加载
评论 #41024856 未加载
评论 #41023584 未加载
评论 #41025937 未加载
dist1ll10 months ago
It seems like I can&#x27;t include standard header files, so it can&#x27;t compile a common hello world. I guess that&#x27;d be useful to mention on the README, or maybe I&#x27;m doing something wrong?<p><pre><code> main.c:1:10: fatal error: &#x27;stdio.h&#x27; not found #include &lt;stdio.h&gt; </code></pre> It&#x27;d be nice if header inclusion, and -l options work. This would allow benchmarking Aro against some other compilers on a wide range of C files. Usually sqlite3.c is my first go-to for stress-testing C compilers.
评论 #41020689 未加载
tiffanyh10 months ago
The ReadMe is quite lacking …<p>- why create a competing front end to Zig?<p>- what problems is it solving?<p>- what’s different than the official Zig frontend?<p>Etc
评论 #41020851 未加载