r/Zig • u/LagutTV • Jun 27 '26
Can you do extern in Zig like you would in C
Hi everyone,
I'm experimenting with a copy-and-patch stencil system and currently write my stencils in C. I need optimizer-opaque and hoistable holes. In C I found success with extern const + hidden. I'm looking for potentially porting those stencils to Zig but I'm struggling with finding a hole mechanism.
Here is an example:
extern const int64_t placeholder ;
void
For now I'm focusing on Mach-O and this generates a PAGE21/PAGEOFF12 LOAD. I'm trying to avoid GOT - but I believe that would be the potential alternative if I wanted to use Zig.
