-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(zig-sdk): Implement Host Functions #249
Conversation
It should be done now, the check randomly fails because of threads |
Awesome, @usdogu - thank you! I will test this out and get back to you asap. |
I have TODOs to update the extism.org docs with the latest build.zig configuration from this PR. |
It seems (based on this comment) that there was just a minor missing step to ensure the Thread resources were cleaned up.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 awesome work, @usdogu!
Updated docs: https://extism.org/docs/integrate-into-your-codebase/zig-host-sdk/ @usdogu, if you have some time to review, please let me know if you see anything incorrect there. Thanks! |
@nilslice, In build.zig --- old.zig 2023-02-13 00:08:40.411043737 +0300
+++ build.zig 2023-02-13 00:10:27.331042426 +0300
@@ -4,21 +4,21 @@
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
- .root_source_file = "src/main.zig",
+ .root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
// Add the `extism` library from the cloned repository
- exe.addAnonymousModule("extism", .{ .source_file = .{ .path = "src/main.zig" } });
+ exe.addAnonymousModule("extism", .{ .source_file = .{ .path = "libs/extism/zig/src/main.zig" } });
exe.linkLibC();
@@ -30,9 +30,11 @@
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
- const exe_tests = b.addTest("src/main.zig");
- exe_tests.setTarget(target);
- exe_tests.setBuildMode(mode);
+ var exe_tests = b.addTest(.{
+ .root_source_file = .{ .path = "src/main.zig" },
+ .target = target,
+ .optimize = optimize
+ });
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&exe_tests.step); |
Updated -- thank you for catching the path issue, and fixing the test config! I'm always learning more about Zig :) |
There are some breaking changes: