Skip to content

fix: restore registerDecls on Zig 0.16#59

Merged
GrapeBaBa merged 1 commit into
mainfrom
fix/register-decls-zig-0.16
Jul 24, 2026
Merged

fix: restore registerDecls on Zig 0.16#59
GrapeBaBa merged 1 commit into
mainfrom
fix/register-decls-zig-0.16

Conversation

@GrapeBaBa

@GrapeBaBa GrapeBaBa commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Motivation

registerDecls is publicly exported, but consumers cannot instantiate it on Zig 0.16. Its implementation declares a type return without returning a type, uses obsolete type-info tags, and still calls the pre-CallbackInfo(argc) function APIs. The string branch also exits module initialization before assigning the export.

Description

  • Return void to match the registration side effect.
  • Update type-info tags and callback construction for Zig 0.16 and the current createFunction API.
  • Preserve the existing behavior of the options parameter.
  • Register string declaration values before continuing through the remaining exports.
  • Add a Node addon fixture and Vitest coverage for function and string declarations.

Comment thread src/register_decls.zig

pub fn registerDecls(comptime decls: anytype, comptime options: anytype) type {
pub fn registerDecls(comptime decls: anytype, comptime options: anytype) void {
_ = options;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should not swallow the options. #61

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, noticed this, prefer a separate PR for this fix

@GrapeBaBa
GrapeBaBa merged commit 7f3af3e into main Jul 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants