Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.
/ zig-win32 Public archive

Bindings for win32, with and without WIN32_LEAN_AND_MEAN

License

Notifications You must be signed in to change notification settings

GoNZooo/zig-win32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zig-win32

Archived

I would suggest using this library instead. If there is some reason you cannot, feel free to reach out and I'll unarchive this so people can continue to work on it if they want.

Linking

You will need to add something like the following to your build.zig depending on what you end up using:

If you're using the win32.c module, most functions are annotated with their library information, so you don't need to link anything, but at the time of writing the lean_and_mean module is not annotated. With that in mind, you may have to add build instructions like the following, depending on which functions you use:

const exe = b.addExecutable("executable-name", "src/main.zig");
exe.addPackagePath("win32", "./dependencies/zig-win32/src/main.zig");
exe.linkSystemLibrary("c");
exe.linkSystemLibrary("gdi32");
exe.linkSystemLibrary("user32");
exe.linkSystemLibrary("kernel32");

Usage in files

A simple import will do it, access the sub-namespaces with c and lean_and_mean:

const win32 = @import("win32");
_ = win32.c.MessageBoxA(...);

Or import one of the sub-namespaces directly:

const win32 = @import("win32").lean_and_mean;
_ = win32.MessageBoxA(...);

Macros not available in the FFI files

MAKEINTRESOURCE{A,W} is not available in the generated files, but is available in the top namespace:

const win32 = @import("win32");
const resource: windows.LPSTR = win32.MAKEINTRESOURCEA(32512);

About

Bindings for win32, with and without WIN32_LEAN_AND_MEAN

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages