Zig NIF build fails for Windows


Has anybody tried to build a NIF for windows from zig? I’ve tried some simple example like here and it compiles fine for linux but fails for windows.

erlang 26.0.2
erts 14.0.2
zig build -Doptimize=ReleaseSafe -Dtarget=x86_64-windows-gnu -Dcpu=x86_64+avx2+fma+f16c
.../.cache/zig/o/fd974bef86d31696e095394b199d0217/erl_nif.zig:2316:80: error: no field named 'NAME' in struct 'erl_nif.TWinDynNifCallbacks'
pub inline fn ERL_NIF_API_FUNC_MACRO(NAME: anytype) @TypeOf(WinDynNifCallbacks.NAME) {
.../.cache/zig/o/fd974bef86d31696e095394b199d0217/erl_nif.zig:1125:40: note: struct declared here
pub const TWinDynNifCallbacks = extern struct {

Not sure what this problem is exactly, but with that target (…-gnu) you will definitely run into problems later as stock Erlang is compiled with MSVC, Been there :slight_smile: