#Passing mutable variable from build.zig
1 messages · Page 1 of 1 (latest)
What i want to do/see if possible is: Can I have a comptime mutable, that is reachable by all functions? Since I cannot have a mutable global, could I instead pass some sort of struct/whatever from build.zig, which would be mutable at comptime and reachable by all functions
No, you can't mutate (at runtime) a compile time constant. Without seeing your code it's hard to say, but it sounds like you want to bundle these functions as methods in a struct and store the data in the struct instance instead. There are a few other ways to do it, but it all depends on what you're trying to do with it.
!xy moment
You're asking about your attempted solution to a problem instead of asking about your problem. Please state your actual problem instead. https://xyproblem.info/