register works

This commit is contained in:
2026-01-23 11:23:07 +01:00
parent aa4d7f73a8
commit 9b94159f8e
5 changed files with 28 additions and 7 deletions

View File

@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
const release = b.option(bool, "release", "To build a wasm release") orelse false;
const exe = b.addExecutable(.{
.name = "math",
.name = "zig",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,

View File

@@ -1,5 +1,5 @@
{
"id": "niklas/zig/math",
"id": "max/nodarium/zig",
"outputs": [
"float"
],

View File

@@ -1,6 +1,6 @@
const std = @import("std");
const def linksection("nodarium_definition") = @embedFile("input.json");
const def = @embedFile("input.json");
export fn execute(ptr: *anyopaque, len: c_int) c_int {
_ = ptr; // autofix
@@ -19,3 +19,11 @@ export fn __free(ptr: *anyopaque, len: c_int) void {
const mem: [*]u8 = @ptrCast(@alignCast(ptr));
std.heap.wasm_allocator.free(mem[0..@intCast(len)]);
}
export fn getDefinitionPtr() *const anyopaque {
return def.ptr;
}
export fn getDefinitionLen() usize {
return def.len;
}