#windows.h variables cause a unable to translate macro error

1 messages · Page 1 of 1 (latest)

tired wedge
#

Hi, I am trying to learn how I can move my windows programming over from c to zig by starting with a basic window using only the win32 api and a cimport of windows.h. I am running into this issue where I can't use the macros from the cimport of windows.h as it results in the following error on zig build run:

cimport.zig:55490:29: error: unable to translate macro: undefined identifier `A`
pub const __MINGW_NAME_AW = @compileError("unable to translate macro: undefined identifier `A`");

Here is the basic setup I got right now with just an hInstancevariable for trying the cimport out:

const windows = @cImport(@cInclude("windows.h"));

pub fn main() !void {
    const hInstance: windows.HINSTANCE =      windows.GetModuleHandle(null); 
    _ = hInstance;
}

Thanks for any help in advance

slender kestrel
#

You can use std.os.windows.kernel32.GetModuleHandleW.

tired wedge
#

yeah I am trying to do it without a library or a binding for now

#

will is std.os.windows give me everything I need or will I still need to use the cimported header?

slender kestrel
#

if not, you'll have to find a workaround

#

sorry -- windows.h uses a lot of stuff that zig can't translate yet

tired wedge
#

ok I will probably then have to do some research on basic window/dx3d setups in zig and compare them to my raw native c code then to see the limitations/benefits/tradeoffs

slender kestrel
#

there's this