Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,65 @@
A complete autogenerated set of Zig bindings for the Win32 API.

These bindings are generated by https://github.com/marlersoft/zigwin32gen

## Install / Update (v0.12.0)

Re-run this command to overwrite and update hash to get latest updates

```bash
zig fetch --save https://github.com/marlersoft/zigwin32/archive/main.tar.gz
```

This will add an entry into `dependencies` in your `build.zig.zon` file like this:

```zig
.{
// ...
.dependencies = .{
.zigwin32 = .{
.url = "https://github.com/marlersoft/zigwin32/archive/main.tar.gz",
.hash = "<hash>"
}
}
}
```

After the package is installed. The package/dependency can be referenced and added to the `build.zig` file to expose it to libraries and executables.

```zig
// build.zig
// ...
pub fn build(b: *std.Build) void {
// ...
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

const zigwin32 = b.dependency("zigwin32", .{});

const your_module = b.addModule("your-module", .{
.root_source_file = b.path("src/root.zig"),
});

your_module.addImport("zigwin32", zigwin32.module("zigwin32"))

// or

const exe = b.addExecutable(.{
.name = "<your exe name>",
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
});

exe.root_module.addImport("zigwin32", zigwin32.module("zigwin32"))

// ...
}
```

Now the dependency is fully imported and can be used

```zig
// any-file.zig
const zigwin32 = @import("zigwin32");
```