ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<GitHub145>
[zig] thejoshwolfe pushed 1 new commit to master: https://git.io/vbgnc
<skyfex>
There's something very weird going on though. I tried to define a const string, but then the linker complained that memcpy was missing. I was going to write my own memcpy, so I defined the function but didn't fill it out. I tried to compile just to check that it would link, and suddenly it just worked. No idea what's really going on
<andrewrk>
zig creates memcpy (and other primitives) for you when you do build-exe or build-lib
<andrewrk>
in builtin.o
<andrewrk>
but if you do build-obj then it's assumed you're going to link against libc or similar
<andrewrk>
what build command are you using?
<skyfex>
build-obj
<skyfex>
Do you know why this code generates code to memcpy btw? Doesn't seem necessary to me:
<skyfex>
const string = "Hello World from Zig!\n"; for (string) |ch| { ... }
<andrewrk>
it probably doesn't once the optimizer runs, but the naive code generated might copy, for example, the ptr and the len from the constant data into a stack variable
<andrewrk>
this is an LLVM thing - it can generate calls to memcpy and some others, so we have to make them available
<andrewrk>
is there any way you could use build-exe instead of build-obj ?
<andrewrk>
the linker is failing right? but then you could try the way you're linking, but with all the args given with --verbose-link
<andrewrk>
which will include builtin.o
<skyfex>
I tried a few things. I tried "build-exe .." and "build-obj lib/std/special/builtin.zig" .. the issue then is the built-ins related to float.