ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
mnoronha has joined #zig
mnoronha has quit [Ping timeout: 268 seconds]
mnoronha has joined #zig
mnoronha has quit [Ping timeout: 272 seconds]
mnoronha has joined #zig
emekoi has joined #zig
darithorn has quit [Quit: Konversation terminated!]
lqd has quit [Quit: Connection closed for inactivity]
mnoronha has quit [Ping timeout: 245 seconds]
<emekoi> is the hello_libc example up to date?
emekoi has quit [Ping timeout: 256 seconds]
<andrewrk> emekoi, yes - it's covered by the main test suite
<andrewrk> ./zig build-exe ../example/hello_world/hello_libc.zig --library c
Graznarak has joined #zig
<Graznarak> Does Zig have anything special that you have to do, besides casting an int to a pointer, to place a structure at a specific memory location?
<andrewrk> Graznarak, no
<andrewrk> if it's memory mapped I/O you might want volatile
<Graznarak> Ok. I know in C++ (and maybe C?) it is UB to dereference a pointer that does not point to memory received from the runtime.
<Graznarak> That will definitely make it easier to do some bare metal stuff.
<andrewrk> I'm off to bed. I'll check back for more questions in the morning
<tyler569> that's not accurate Graznarak, it's just implementation-defined
<tyler569> in C at least
emekoi has joined #zig
emekoi has quit [Ping timeout: 256 seconds]
Hejsil has joined #zig
very-mediocre has joined #zig
sepisoad has joined #zig
<sepisoad> hi, where can i find documentation about using c library in zig, I have a c library which i want to use in my zig program, I need to include a couple of c header files and the link to some static and shared libraries
sepisoad_ has joined #zig
sepisoad has quit [Client Quit]
<Hejsil> I don't think there are any documentation on this front yet. Are you using the build system or just building from the commandline?
lqd has joined #zig
<sepisoad_> Hejsil: i am using command line ATM
<sepisoad_> the documentation for zig build is missing
tiehuis has joined #zig
<tiehuis> sepisoad_: here is an example using the build system: https://github.com/tiehuis/zig-lua/blob/master/build.zig
<Hejsil> Alright. The command line has a --library option. It works the same as -l in C compilers
<tiehuis> on the command-line the `--object` and `--library` flags should get you most of the way there
<tiehuis> `--library` can take a specific file-path to a dynamic library
<tiehuis> can't remember if static libraries need to be specified using `--library` or `--object` but one of those should work
<sepisoad_> tiehuis, Hejsil: thanks
tiehuis has quit [Quit: WeeChat 2.2]
tankf33der has joined #zig
davr0s has joined #zig
Hejsil has quit [Ping timeout: 256 seconds]
Hejsil has joined #zig
Hejsil has quit [Ping timeout: 256 seconds]
porky11 has joined #zig
tankf33der has left #zig [#zig]
dimenus has joined #zig
<dimenus> andrewrk: congrats on 0.3 release!
mnoronha has joined #zig
<andrewrk> dimenus, thanks :)
sepisoad_ has quit [Ping timeout: 256 seconds]
<andrewrk> scientes, I'm looking at your ARM PR now
<andrewrk> did you have a solution in mind for CI or should I investigate that now?
euantor has joined #zig
kmelva has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<kmelva> Is there a way to introspect struct field names in a metaprogramming way? For example for implementing serialization to JSON?
<andrewrk> kmelva, better example, look at lines 175-188
mnoronha has quit [Ping timeout: 244 seconds]
<kmelva> cool, thanks!
halosghost has joined #zig
<andrewrk> kmelva, you may also be interested in this proposal: https://github.com/ziglang/zig/issues/1099
<andrewrk> although you could probably get away without needing something like that, playing tricks with empty structs
<andrewrk> since empty structs are available to reflection but do not generate any runtime code
<andrewrk> automatic json serialization/deserialization is something people have thought about but nobody has blazed the trail yet
<kmelva> I think @typeInfo/@typeId are what I was looking for!
<andrewrk> you can probably build your code using the lower-level JSON api in the standard library
mnoronha has joined #zig
davr0s_ has joined #zig
<Graznarak> Can you place a struct (think interrupt vector) at a specific location? Last night we established that you can point a pointer to any location you want.
<andrewrk> Graznarak, wouldn't that be the same thing as pointing a pointer to a struct to a specific location?
<andrewrk> have a look at this project, I think it does a lot of what you want: https://github.com/AndreaOrru/zen/blob/6634c9ce7cf849741f5d340b1b1bc35f906307bc/kernel/vmem.zig#L14
<Graznarak> So, do something like create a pointer and initialize the struct at compile-time?
<andrewrk> I see what you're asking. You need a linker script for that
<Graznarak> Thanks. That was exactly what I was looking for.
tankf33der has joined #zig
<andrewrk> scientes, this is great work
Thalheim has quit [Remote host closed the connection]
Thalheim has joined #zig
mnoronha has quit [Ping timeout: 252 seconds]
davr0s_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
darithorn has joined #zig
porky11 has quit [Ping timeout: 260 seconds]
davr0s has joined #zig
clownpriest has joined #zig
clownpriest has quit [Client Quit]
very-mediocre has quit [Ping timeout: 256 seconds]
mnoronha has joined #zig
very-mediocre has joined #zig
clownpriest has joined #zig
<halosghost> ugh; I really wish I could work on Zig (or even C) at $DAYJOB
<halosghost> C# is a bit soul-crushing
<halosghost> s/on/with/
<very-mediocre> halosghost: recently I had to extend a PHP codebase from 2007
<very-mediocre> I know that feel.
<halosghost> very-mediocre: ):
<halosghost> very-mediocre: $DAYJOB is rewriting a C# codebase that feels like it was written sometime around Leviticus. But I'm being pushed into using things like EntityFramework which suck
<halosghost> it's really frustrating
<very-mediocre> C# became much more Javaish at some point
<halosghost> I thought it always was
<very-mediocre> Like you're not expected to compose things on your own, no, you use the "official" EntityFramework
<halosghost> but it definitely feels like Java
<very-mediocre> I used early C# circa 2.0
<very-mediocre> it was a lot less opinionated
<very-mediocre> I checked out .NET core recently and I cringed when I saw you had to instantiate a "Kestrel" to start the server
<very-mediocre> This is gonna sound like blasphemy - but JavaScript seriously liberated me from that kind of mindset
<halosghost> yeah
<very-mediocre> anonymous objects were an epiphany for me
<halosghost> C liberated me from that mindset
<very-mediocre> You're more perceptive than me then
<very-mediocre> lol
<very-mediocre> I started with C and then got involved in C# thinking of it as an "evolution"
<halosghost> yeah
<halosghost> after I figured out what void* is and its basic semantics, the trappings of big frameworks fell on my ears, deaf
<very-mediocre> It makes sense for languages to be minimalistic
<very-mediocre> DRY works as a metaconcept too
<very-mediocre> C# and Java have too many overlapping concepts
SimonNa has quit [Remote host closed the connection]
SimonNa has joined #zig
SimonN has joined #zig
SimonN has quit [Remote host closed the connection]
mahmudov has joined #zig
clownpri1 has joined #zig
clownpriest has quit [Ping timeout: 252 seconds]
clownpri1 has quit [Client Quit]
dimenus has quit [Quit: Leaving]
very-mediocre has quit [Ping timeout: 256 seconds]
very-mediocre has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mnoronha has quit [Read error: Connection reset by peer]
mnoronha has joined #zig
mnoronha has quit [Read error: Connection reset by peer]
davr0s has joined #zig
very-mediocre has quit [Ping timeout: 256 seconds]
mnoronha has joined #zig
<edr> we need a #zig-offtopic so I can argue some of these points ;)
mnoronha has quit [Read error: Connection reset by peer]
<rom1504> Kestrel is the server
<halosghost> you're a server
<andrewrk> hopefully this coroutine rewrite I'm doing works well, then we can have zig servers
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<bbrittain> tell me more about this rewrite...
halosghost has quit [Quit: WeeChat 2.2]
kmelva has quit [Ping timeout: 268 seconds]
tom1998 has joined #zig
<tom1998> heyo!
<tom1998> I'm trying to @cimport enet (a networking abstraction library), I'm getting this:
<tom1998> compiler bug: @cImport generated invalid zig code
<tom1998> pub const enet = @cImport({
<tom1998> So, after double checking, i'm like 99% sure this isn't the enet library - it's saying that there's a redefinition of 'suboptarg'
<tom1998> It won't display the C source code though, so i'm not sure - is there something I've #defined wrong?
mnoronha has joined #zig
<tom1998> I'm aware this isn't too much info, but this err msg is giving me tnothing
tom1998 has quit [Ping timeout: 245 seconds]
tom1998 has joined #zig
davr0s has joined #zig
<andrewrk> tom1998, you can use `zig translate-c` command line interface to see the zig code that @cImport generates
<andrewrk> it might be this issue: https://github.com/ziglang/zig/issues/1359
<andrewrk> short summary is: LLVM's coroutine support is buggy, slow, and has poor semantics. so we're going to redo it using normal structs & functions
<andrewrk> async can no longer give error.OutOfMemory. coroutine frames can be allocated on the stack, heap, globally, etc, just like any other type
<andrewrk> cancel no longer needs to do a reference counting thing, since coroutines don't free themselves
<tom1998> After moving to my linux laptop, seems like this issue only happens on OSX, although I was using GCC on linux, let me try with Clang on linux
<tom1998> Also built fine with clang on linux
<tom1998> I have to get to bed now, but I'll have a look on translate-c tomorrow, does zig just run translate-c on all the c code then compile it as zig code?
<andrewrk> tom1998, yes, except it goes directly to AST in memory; it does not literally run a command line application and then generate text and parse text
<andrewrk> a better way to think of it would be that translate-c is doing @cImport and then rendering the AST to text
tom1998 has quit [Ping timeout: 268 seconds]
mnoronha has quit [Ping timeout: 272 seconds]