←back to thread

Zig is hard but worth it

(ratfactor.com)
401 points signa11 | 1 comments | | HN request time: 0.202s | source
Show context
ldelossa ◴[] No.36150624[source]
I'm surprised that the reason I'm mostly interested in Zig is not mentioned.

This is C interop.

I work with C quite a bit and I enjoy it, however writing a large project in C can be tiresome.

Having an option like Zig which can import C headers and call C functions without bindings is pretty attractive, especially when you want to write something a big larger but still stay in C world.

replies(6): >>36151152 #>>36151354 #>>36151700 #>>36153013 #>>36153780 #>>36158610 #
workethics ◴[] No.36151152[source]
Not only that, but zig makes linking against old glibc versions easy. For example, to make an x86_64 linux build linked against glibc 2.9 when using zig build all you have to do is pass:

  -Dtarget=x86_64-linux-gnu.2.9
replies(3): >>36152369 #>>36158596 #>>36184449 #
1. beefcafe ◴[] No.36158596[source]
This is a killer feature for CTFs/OSCP/etc and why I started using it.