ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<GitHub165>
[zig] dimenus opened pull request #617: Added DLL loading capability in windows to the std lib. (master...dll-load) https://git.io/vFyLn
dimenus has joined #zig
<andrewrk>
dimenus, can you read the other comments I posted on the previous pull request?
<dimenus>
just need to tag 534 i think
<dimenus>
the return was modified and i didn't include the checking we mentioned earlier
<dimenus>
GOD DAMN TABS
<dimenus>
sorry, tests failed due to tabs :(
<andrewrk>
you can use -Dtest-filter=foo to target some tests only
arBmind1 has joined #zig
arBmind has quit [Ping timeout: 240 seconds]
<andrewrk>
dimenus, oh, sorry I guess my other comment didn't get added
<andrewrk>
adding now
jfo has quit [Ping timeout: 248 seconds]
<dimenus>
i think VR is one of the few things keeping me on windows
<dimenus>
pacman is so superior to anything windows has
<dimenus>
andrewrk, sorry i don't understand the full command syntax to execute specific tests
<GitHub177>
zig/master a7d07d4 dimenus: Added DLL loading capability in windows to the std lib.
<GitHub177>
zig/master 3e83597 Andrew Kelley: Merge pull request #617 from dimenus/dll-load...
<dimenus>
thanks andrewrk
<dimenus>
also i found a case your union code doesn't quite support yet :)
<dimenus>
nvm, i haven't built latest zig.....
<andrewrk>
dimenus, I think our macro parser doesn't understand field access
<andrewrk>
but we can add that
<dimenus>
yeah the unions look properly formatted now in the output
<dimenus>
which is good
<dimenus>
(using latest zig)
jfo has quit [Ping timeout: 240 seconds]
<andrewrk>
dimenus, I think it's just a matter of adding a '.' token to c_tokenizer.cpp and then updating parse_ctok in parsec.cpp to look for field access, and create a zig FieldAccess AstNode
<dimenus>
cool
<dimenus>
i could probably work on that later today
<andrewrk>
jfo, yes, we do not have advanced value tracking yet
<jfo>
yat \o/
<andrewrk>
there is a whole class of compile errors that can be enabled when we have it
<jfo>
awesome
<andrewrk>
and faster debug code that omits safety checks when it knows they're unnecessary
<dimenus>
andrewrk, just hit 'unable to evaluate constant expression' @ ir.cpp:6631
<dimenus>
only triggers on my macro'ified union situation
<dimenus>
getting two errors per one function call (same message)
<andrewrk>
can I see the zig code that has the error?
<dimenus>
yes
<dimenus>
'?extern fn(c_uint)
<dimenus>
how do you unwarp that?
<dimenus>
i want to use that function
<andrewrk>
do you want to assert that it is nonnull? or check if it is null before calling it? it works like every other nullable type
<andrewrk>
oh god the docs are wrong
<andrewrk>
#465 can't come quickly enough
<andrewrk>
(??fn_name)(x)
<andrewrk>
this asserts that it is non-null
<dimenus>
probably not good to stick in a loop though
<dimenus>
getting you an example btw
<andrewrk>
it's fine to put in a loop, here's why
<andrewrk>
* if it's in a performance bottleneck, you'll use @setDebugSafety(this, false) to disable all the debug safety checks for that block of code, making it perfectly free, just like ReleaseFast mode
<andrewrk>
* if it's not in a performance bottleneck, you won't notice it being slow
<andrewrk>
I think there are 2 things going on here
<andrewrk>
1. the code in process_symbol_macros in parse.cpp is fooled by field access, so it doesn't do the thing where it makes an inline function alias that ignores the possibility of null
<andrewrk>
if you added that I think it would make this work
<andrewrk>
2. maybe we have a compiler crash if you try to execute a nullable function pointer right now, I'll have to check. we definitely want to fix that
<dimenus>
i also ran into another crash working on this, i don't think it's related though
<dimenus>
the null check wasn't there before and path was null
<andrewrk>
oh, I ran into this earlier today but I didn't fix it yet
<dimenus>
i realize what i did was a hack, just trying to debug other stuff
<andrewrk>
this problem is because we assume AstNodes have info about what zig import file they came from, but if they come from C that value is null
<dimenus>
ah, it gets put in the c->macro_table instead of the c->macro_symbol table
<dimenus>
I think MacroSymbols should store a handle to their AST nodes so that in process_symbol_macros we can verify that we're at the top of the chain before checking if we're in the global table
<andrewrk>
that sounds reasonable
<dimenus>
what's happening now is that even if i put field expressions in the macro symbol table instead of the regular macro table
<dimenus>
they still won't get an inline function because they're not in the globals table (top level anyway)_