<AlexMax>
does anybody have any experience linking against win32?
<daurnimator>
a little...
<daurnimator>
AlexMax: IIRC zig links against it automatically if you use functions from it
<AlexMax>
i'm trying to do the "build your c program as zig" thing and I've resolved some issues, but I'm getting stuck trying to resolve WinMainCRTStartup and what looks like a bunch of standard c symbols.
<mq32>
this line looks like a subtle bug to me as outStream() returns a temporary value that is not stored anywhere and we take a pointer to a child element
<mq32>
or is this guaranteed to work in zig?
<daurnimator>
mq32: I see that pattern around a bit
<mq32>
yeah, that's why i'm asking
<daurnimator>
mq32: FWIW I'm fixing all of those with my incoming "Mixin" PR
<mq32>
:)
<daurnimator>
just waiting for a couple of other things to be merged first
<mq32>
> std.io.getStdOut and related fns no longer can error
<mq32>
this is a really nice addition :)
<mq32>
do we have something like "float equals"?
<daurnimator>
mq32: you mean like some sort of epsilon comparison?
<mq32>
yeah
<mq32>
i think i've seen something like that
<daurnimator>
Its very rare to need it... what corner have you painted yourself into?
<mq32>
"testing a conversion function"
<daurnimator>
conversion to/from?
<mq32>
"index on piano keyboard" to "frequency in Hz"
<mq32>
440 hertz * (2^(1/12))^(i - 49)
<mq32>
it's this beauty
tines9 has quit [Remote host closed the connection]
<mq32>
i haven't seen much code that is "twelfth root of 2 to the power of i minus 49"
<daurnimator>
isn't ^ xor not power?
<mq32>
it's notation from my calculator program :D
<mq32>
"name: [_]u8" is invalid as the size isn't known
<muffindrake>
That seems strangely roundabout, but thanks!
<mq32>
it just follows the language rules :D
bjorob has joined #zig
bjorob has quit [Ping timeout: 240 seconds]
dimenus has joined #zig
<muffindrake>
Alright, and to recap, if I have a `const s = struct { name: [16]u8 = [_]u8{0} ** 16}` and wanted to make an array of this structure in a field of another, I would use `const b = struct { a: [666]s = [_]s{s{}}} ** 666`, or am I doing something horribly wrong here?
<muffindrake>
Missing } at the end, anyhow.
<mq32>
sounds reasonable
frmdstryr has joined #zig
<muffindrake>
I was going to say that default initalization was easier to do in C, but then I remembered that there is no such thing as writing your own default initializer for structs, because no such thing exists in C.
<muffindrake>
Still, it's far more convenient to write something like `uint_least16_t a[16] = {0}` than the above.
knebulae has quit [Quit: Leaving]
frmdstryr has quit [Ping timeout: 268 seconds]
return0__ has joined #zig
return0e has quit [Ping timeout: 245 seconds]
<muffindrake>
Huh, I seem to have placed a variable at global scope which triggered a runtime crash, which went away when I put it into local scope into main. I'll try to get a minimal example.
<muffindrake>
Is this supposed to segfault at runtime?
<muffindrake>
Placing 'var c' inside main won't segfault
<FireFox317>
muffindrake, if you just want to zero init it, it is probably easier to just use `mem.set`
<muffindrake>
Of course.
<mq32>
oh. zig build is allergic to "moving the project folder"
doublex has quit [Ping timeout: 250 seconds]
jokoon has joined #zig
waleee-cl has joined #zig
<muffindrake>
Strangely, my example segfaults only in debug mode, not release mode. How strange.
<muffindrake>
I am running master.
muffindrake has quit [Quit: muffindrake]
muffindrake has joined #zig
return0__ has quit [Read error: Connection reset by peer]
return0e has joined #zig
doublex has joined #zig
stratact has joined #zig
knebulae has joined #zig
protty has joined #zig
<protty>
Is there a way to use translate-c from build.zig? Can invoke it using `addSystemCommand()` but unsure how to pipe that result into a .zig file
<mq32>
why would you need that? "prevent headers"?
<mq32>
you can always convert-c just once and just include the resulting zig file
<protty>
the system its running on and the file it translates can differ from machine to machine (jni.h)
<mq32>
uarks :D
<mq32>
addSystemCommand should probably do it, if it allows you to pipe
<mq32>
in case of trouble, call a shell script
jokoon has quit [Quit: jokoon]
<protty>
better q would be "how to pipe from addSystemCommand()"
FireFox317 has quit [Ping timeout: 245 seconds]
return0e_ has quit [Remote host closed the connection]
protty has quit [Ping timeout: 260 seconds]
dingenskirchen1 has joined #zig
dingenskirchen has quit [Ping timeout: 245 seconds]
dingenskirchen1 is now known as dingenskirchen
mahmudov has joined #zig
stianhj has quit [Quit: WeeChat 2.6]
THFKA4 has quit [Quit: WeeChat 2.4]
wootehfoot has joined #zig
bjorob has joined #zig
dtz has quit [Write error: Connection reset by peer]
mattmurr has quit [Read error: Connection reset by peer]
Demos[m] has quit [Read error: Connection reset by peer]
fengb has quit [Remote host closed the connection]
D3zmodos has quit [Remote host closed the connection]
Snektron has quit [Remote host closed the connection]
BitPuffin has quit [Remote host closed the connection]
lunamn has joined #zig
FireFox317 has joined #zig
traviss has quit [Quit: Leaving]
doublex has quit [Ping timeout: 250 seconds]
porky11 has joined #zig
doublex has joined #zig
lunamn_ has joined #zig
lunamn has quit [Ping timeout: 250 seconds]
FireFox317 has quit [Ping timeout: 245 seconds]
dimenus has quit [Ping timeout: 265 seconds]
doublex_ has joined #zig
doublex has quit [Ping timeout: 245 seconds]
ltriant has joined #zig
marijnfs has joined #zig
wilsonk has quit [Ping timeout: 245 seconds]
wilsonk has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
<leeward>
Is there any kind of reflection support for structs? I have a packed struct of `u1`s and I want to be able to refer to its fields programmatically.
<leeward>
traviss: I didn't get to it, but it seems likely.
<leeward>
distracted by other things
<mq32>
pixelherodev, you there?
dimenus has joined #zig
bjorob has quit [Ping timeout: 240 seconds]
adamkowalski has joined #zig
<adamkowalski>
Can anybody point me to some documentation for linking against a C library? I installed sdl2 with brew so it's in `/usr/local/Celler/sdl2/...`.
<dimenus>
adamkowalski: `--library c` on the command line or `exe.linkSystemLibrary("c");` in your build.zig
<dimenus>
oh, linking against a c library
<mq32>
adamkowalski, you have to manually add the library, library search path and include by hand
<daurnimator>
andrewrk: #3644 passed CI after retriggering. would love to have that merged :)
<mq32>
did i say "i love zig" today already?
<adamkowalski>
I tried adding exe.linkSystemLibrary("sdl2");
<adamkowalski>
How so I determine the search path for the system libraries?
<adamkowalski>
whats the best practice with third party c libraries. I don't want to rely on my system location because then I can't deploy it
<adamkowalski>
or it will have to be identical on the production machine right?
<daurnimator>
mq32: no; your penalty is 10 "i love zigs" and a "I have faith in the ziguana"
<mq32>
daurnimator: I've seen the word "ziguana" more often today than you! :D
<daurnimator>
I just woke up, so probably
<mq32>
haha, damn timezones
<adamkowalski>
If I put an include folder in my project root, and a lib folder. Copy the contents from the brew install and put them into the respective directory, is that a good idea?
<daurnimator>
Great ziguana, may he take off with every zig.
<dimenus>
adamkowalski: `linkSystemLibrary` name is kind of misleading, it's basically just a compiled library
<dimenus>
did you look at my build.zig?
<daurnimator>
adamkowalski: IIRC linkSystemLibrary also consults pkg-config: does your library have a pkg-config file?