Apparently the free function is in the stdlib.h
library and I just needed to add it to my c_imports like this:
const c = @cImport({
@cInclude("xcb/xcb.h");
@cInclude("stdlib.h");
});
Then, I changed all the xcb.
to c.
in the code and added c.free(event)
at the end of the loop.
I ran zig build
but there was a problem with compiler not finding free again. Finally, I understood that I have to add exe.linklibC();
to my build.zig
so that it could work. It now runs and there is no major issue. There are only some warnings that I need to understand:
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning: Could not resolve keysym XF86RefreshRateToggle
> Warning: Could not resolve keysym XF86Accessibility
> Warning: Could not resolve keysym XF86DoNotDisturb
Errors from xkbcomp are not fatal to the X server