Skip to content

Conversation

@Senryoku
Copy link
Contributor

Fixes compilation (on Windows at least) with the just released zig 0.15.1

  • Removed use of previously deprecated APIs in build script (addStaticLibrary and root_source_file)
  • Removed use of deprecated alias callconv(.C) for callconv(.c)
  • Smaller changes:
    • alignedAlloc takes a std.mem.Alignment instead of an arbitrary int
    • std.time.sleep -> std.Thread.sleep
    • std.ArrayList isn't managed by default anymore (deinit takes an allocator)

Only tested on Windows and in a very small program as I'm still in the process of migrating my own projects.
Hope this is still useful!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the zaudio library to be compatible with Zig 0.15.1, addressing compilation issues by replacing deprecated APIs and updating standard library usage patterns.

Key changes:

  • Updated build script to use new Zig 0.15.1 APIs for library creation and module management
  • Replaced deprecated callconv(.C) with callconv(.c) throughout the codebase
  • Updated memory allocation and standard library function calls to match new API signatures

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
build.zig.zon Updates minimum Zig version requirement to 0.15.1
build.zig Replaces deprecated addStaticLibrary with new module/library creation pattern
src/zaudio.zig Updates calling conventions, memory alignment API, ArrayList deinit, and sleep function calls

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

const mem = mem_allocator.?.alignedAlloc(
u8,
mem_alignment,
.fromByteUnits(mem_alignment),
Copy link

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fromByteUnits method expects a power-of-2 alignment value. Consider validating that mem_alignment (16) is a valid alignment or use a compile-time assertion to ensure this constraint is met.

Copilot uses AI. Check for mistakes.
Copy link
Member

@hazeycode hazeycode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@hazeycode hazeycode merged commit dd1f002 into zig-gamedev:main Aug 31, 2025
3 checks passed
hazeycode added a commit that referenced this pull request Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants