ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
donlzx has joined #zig
alexnask_ has quit [Ping timeout: 260 seconds]
darithorn has joined #zig
<GitHub55>
[zig] andrewrk opened pull request #1215: self-hosted: first passing test (master...self-hosted-first-test) https://git.io/fNTdH
Tobba has quit [Ping timeout: 244 seconds]
isd has joined #zig
wilsonk has quit []
peyty has quit [Ping timeout: 252 seconds]
wilsonk has joined #zig
douglas has joined #zig
v1zix has joined #zig
<v1zix>
I looked at the sort function in std.sort and noticed it has helper functions like i32asc, i32desc, etc. for the lessThan parameter but they're not public. Anyone know if there are plans to have helper functions on it for primitive types? I didn't see anything on GitHub issues about it
douglas has quit [Ping timeout: 252 seconds]
mahmudov has quit [Quit: Leaving]
mahmudov has joined #zig
<andrewrk>
v1zix, we can make those public if it's helpful. feel free to make a PR
<andrewrk>
it should be pretty trivial to define those things in the meantime
<tiehuis>
also, i'm thinking i'll add a `--stdin` flag to `zig fmt` since many formatters seem to work a bit nicer when the control the buffer themselves for autoformatting
<andrewrk>
sounds reasonable
<andrewrk>
tiehuis, have you seen the event loop stuff?
<andrewrk>
I'm quite excited about it
<v1zix>
tiehuis, very cool! Yeah I thought there might be a way to essentially return a `fn` with a generic function, but wasn't sure on the syntax
<tiehuis>
andrewrk: yes! very exciting, will be very cool to see how the self-hosted compiler design continues and the end result
<tiehuis>
top-bar of the download page on website is not centered by the way with the last update
<unique_id>
"pNext = true" says the debugger, wait a second .........
<unique_id>
But I'm setting it to pNext = null
return0e has joined #zig
<unique_id>
I'm having a hard time debugging the zig code because even right after explicitly setting info.pNext to null, the debugger prints that info.pNext is 'true'. So... is code gen at fault here? I don't know.
<bheads>
try making VkInstanceCreateInfo a packed struct
<bheads>
Anything you share with C whould be packed
<wilsonk>
Zig also doesn't allow assigning null to something that can't be null...not sure if this holds while true debugging, but it is a language feature that keeps one from shooting oneself in the foot. See https://ziglang.org/documentation/master/#Optionals. Might be relevant there?
<unique_id>
wilsonk: What did I assign null that couldn't be null?
<unique_id>
bheads: then why does zig translate-c use extern structs extensively?
<bheads>
not sure, extern struct is not documented :/ But I have had success with packed structs
<wilsonk>
unique_id: just saying that maybe pNext can't be null in the context you are trying to set it...not sure though. Compiler magic might be possible there, is all
<unique_id>
ah okay, I'm not :)
<unique_id>
and I set it in code, not in the debugger
<andrewrk>
unique_id, bheads is incorrect about using packed for sharing with C
<andrewrk>
apologies for the lack of documentation - I will address that today - but `extern struct` guarantees ABI compatibility with C
<andrewrk>
unique_id, how are you linking against vulkan?
<unique_id>
I do: exe.linkSystemLibrary("vulkan")
<unique_id>
-lvulkan for gcc
<andrewrk>
oh, did you also do libc btw?
<andrewrk>
exe.linkSystemLibrary("c")
<unique_id>
I did
<andrewrk>
hm. I'm not sure what library to install to do that - I get lld: error: unable to find library -lvulkan
<andrewrk>
I thought you had to use one of those dynamic loaders
<unique_id>
Yeah I was also getting that. Linking "c" makes it find vulkan, why I don't know
<unique_id>
No, you can link vulkan. "volk is a meta-loader for Vulkan. It allows you to dynamically load entrypoints required to use Vulkan without linking to vulkan-1.dll or statically linking Vulkan loader."
<unique_id>
but you can use things like volk for a slight perf improvement as well as better errors to users, I guess
isaachier has joined #zig
<isaachier>
hey just announcing i've been working on a game boy emulator. so far just implemented cpu and instruction set. have to work on graphics and audio but docs on this are pretty unclear. if anyone is interested, here it is: https://github.com/isaachier/gbemu.
<isaachier>
obviously written in zig
<unique_id>
cool, always nice to have more zig code to look at!
<andrewrk>
isaachier, awesome!
<andrewrk>
unique_id, are you planning on using glfw, sdl, or something else?
<isaachier>
thanks!
<isaachier>
relating to SDL, that's what i decided to use too. pretty much works out of the box AFAIK.
isaachier has quit [Client Quit]
donlzx has quit [Quit: Leaving]
<andrewrk>
isaachier, if you add a readme I'll link it on ziglang.org
<unique_id>
awesome, I'm excited to see the bug :)
<andrewrk>
looks like zig is generating pNext as a `bool` when it should be a pointer
<andrewrk>
ohhh, it's `?*const void` instead of `?*const c_void`
<andrewrk>
that's a really unfortunate footgun
<andrewrk>
I think I can simply make this a compile error - not allowing pointer to void in extern structs
<andrewrk>
ok that fixes it
<unique_id>
are you sure that fixes it? I don't remember exactly what I was doing but I was also changing void and c_void around, trying things, which didn't seem to affect anything.
<unique_id>
oh it worked
<unique_id>
maybe the issue is unnecessary then
<andrewrk>
unique_id, it should be a compile error - I'll make that be the case before closing the issue
<unique_id>
ok so when I was changing void and c_void around I was dealing with some different issue
<andrewrk>
this is a great example of a foot gun that we don't want zig to have
<pancake>
douglasC: weird will do a clean build and see, but i had to replace the *os.File for &os.File and such
douglasC_ has joined #zig
<douglasC_>
pancake: You on Windows?
<andrewrk>
pancake, it sounds like you're looking at a pretty old version of zig
douglasC has quit [Ping timeout: 252 seconds]
<douglasC_>
testing
<andrewrk>
appveyor tests the examples on windows on every master branch push
<douglasC_>
Appveyor then builds a zip file. Easy to download, extract and run it. Very nice.
<unique_id>
I feel silly not having read about void sooner. The c++ people have been talking about having something like this. Definitely useful for generic code.
<douglasC_>
I am trying to build tetris on Windows. I see that I need libepoxy, GLFW, and libpng. Where do I put them so zig can link to them?
<andrewrk>
douglasC_, I've only ever been able to cross compile tetris for windows - there's an open issue for doing it natively: https://github.com/ziglang/zig/issues/576
<douglasC_>
Ok, I will try in Linux and cross compile.
<andrewrk>
but I haven't tried too hard. you should be able to put them anywhere, and then the problem is just adding to the build script the libraries where they can be found
isaachier has joined #zig
<isaachier>
Thanks @andrewrk! I added a really basic README with just the description, but I'll let you know when I do a more thorough one.
isaachier has quit [Client Quit]
<andrewrk>
douglasC_, libpng is a regrettable dependency on windows
<andrewrk>
I'd love to see a pure zig png library
<douglasC_>
andrewrk: i do not see any prebuilt libpng. Can it be built with VS?
<andrewrk>
when I did it, I obtained it with the mxe project: http://mxe.cc/
very-mediocre has joined #zig
<MajorLag2>
pure zig png is on my todo list
<GitHub49>
[zig] tgschultz opened pull request #1219: Added `remove` to ArrayList (master...arraylist-remove) https://git.io/fNIsN