Skip to main content
-1 votes
1 answer
53 views

Is there a way to compile this C code with Clang or Zig compiler? [closed]

You may have heard of the "Are we fast yet benchmarks". This is the C version. The instructions to compile it are to simply pass * .c and som/ *.c to the compiler and it should work with GCC....
Zebrafish's user avatar
  • 15.1k
0 votes
1 answer
23 views

How to generate an executable output file for "zig build test"

It seems that "zig build test" will run the unit tests automatically, but I want to generate an executable file which calls all the unit test functions, then I would like to load the ...
Felix F Xu's user avatar
-1 votes
1 answer
48 views

How to tell zig to shut up about unsigned values?

I have the following code const std = @import("std"); const stdio = @cImport({ @cInclude("stdio.h"); }); const ioctl = @cImport({ @cInclude("sys/ioctl.h"); @...
Ethan McCue's user avatar
  • 1,016
0 votes
0 answers
42 views

How can I change std.log log level from the command line in Zig?

I'm using std.log in Zig and I want to change the log level (e.g. to .debug or .info) when running tests using the command line. Is there a way to set the log level from zig build, for example like: ...
Filippo Zanelli's user avatar
1 vote
1 answer
60 views

How can I generate a timestamp string using zig?

using zig, I need to generate a timestamp that format exactly or almost matches 2025-04-18T14:03:52.000Z. How can I go about it? using the standard library only
mbithi's user avatar
  • 37
1 vote
1 answer
28 views

Log messages not showing when running tests in Zig (zig build test --summary all

I'm trying to use Zig's logging functionality within my tests, but when I run the tests using the command zig build test --summary all, I don't see the log messages I expect. What I've tried: I've set ...
Filippo Zanelli's user avatar
0 votes
0 answers
90 views

How do I correctly use Optional with pointers in Zig to avoid const errors?

During the study and practice of optionals and pointers in Zig, I encountered behavior that was quite unclear to me. I can't quite understand what exactly the compiler is trying to tell me. In the ...
YeO's user avatar
  • 1
0 votes
1 answer
75 views

Initialising a nullable array struct field in zig 0.14.0

I'm using zig 0.14.0, and having issues with setting a nullable array. I've come up with an example (this is not my main code base or anything close to what I'm doing) to illustrate the issue. const ...
AdmiralJonB's user avatar
  • 2,122
3 votes
1 answer
99 views

Zig as C Linux->Mac cross-compiler for go project with go-sqlite3 error: unable to find dynamic system library 'resolv'

I'm building a Go application with native (CGO_ENABLED=1) SQLite support using https://github.com/mattn/go-sqlite3. I'm trying to get the builder docker image to a reasonable size. (goreleaser/...
user3277119's user avatar
1 vote
1 answer
70 views

How to run a smaple xcb example in zig programming language? [closed]

I am trying to write a simple window manager with xcb in zig where there is an event loop with some possible events (key press, ...). My system is running an arch linux and all the necessary libraries ...
mortimer's user avatar
0 votes
0 answers
54 views

How can I include xcb.zig and glfw into my zig project using zig build system with no error?

I am completely new to zig and system programming. I do not understand anything from the zig build system and I want to include glfw and xcb.zig in my project. I have been looking for documentations ...
mortimer's user avatar
1 vote
1 answer
77 views

How to cast a runtime slice range to fixed array in zig 0.14.0?

Without altering func()'s signature, How am I able to do something like this? const std = @import("std"); fn runtimeNumber() u16 { return 32; } fn func(b: [4]u8) void { std.debug....
sloweax's user avatar
  • 55
1 vote
0 answers
90 views

Inject jmp to my function at address of symbol declaration

I want to place jump to my function on address of other function declaration, specifically CreatePen function for gdi. I'm using zig and that's what i've made so far: const windows = @import("std&...
Nazar's user avatar
  • 11
3 votes
1 answer
123 views

JS/C Interop with zig cc and wasm

I am writing a webassembly demo in C to match a similar demo I wrote in zig. I am currently able to call C functions from JS, and interact with shared memory on either side. However, I can't seem to ...
J. B's user avatar
  • 129
0 votes
1 answer
63 views

Should a function return []const u8 or []u8 if the caller owns the slice

I noticed that a library I'm using frequently returns []const u8 instead of []u8 when it allocates memory and the caller is responsible for freeing it. Should a function return a mutable slice []u8 ...
Luke W.'s user avatar
  • 43

15 30 50 per page
1
2 3 4 5
30