Skip to content

Commit 4bf857d

Browse files
committed
fix(c): use .c calling convention for extern functions
- replace deprecated .C callconv with .c in all extern function declarations in src/c.zig - update internal Zig handlers and bindings to use .c callconv in src/webui.zig - adjust build.zig to maintain compatibility with Zig 0.14 and earlier versions
1 parent 8848fa7 commit 4bf857d

File tree

3 files changed

+131
-117
lines changed

3 files changed

+131
-117
lines changed

build.zig

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,18 @@ pub fn build(b: *Build) !void {
9696
// Function to generate API documentation
9797
fn generate_docs(b: *Build, optimize: OptimizeMode, target: Build.ResolvedTarget, flags_module: *Module) void {
9898
// Create a temporary object for documentation generation
99-
const webui_lib = b.addObject(.{
99+
const webui_lib = b.addObject(if (builtin.zig_version.minor == 14) .{
100100
.name = "webui_lib",
101101
.root_source_file = b.path(b.pathJoin(&.{ "src", "webui.zig" })),
102102
.target = target,
103103
.optimize = optimize,
104+
} else .{
105+
.name = "webui_lib",
106+
.root_module = b.addModule("webui_lib", .{
107+
.root_source_file = b.path(b.pathJoin(&.{ "src", "webui.zig" })),
108+
.target = target,
109+
.optimize = optimize,
110+
}),
104111
});
105112

106113
webui_lib.root_module.addImport("flags", flags_module);
@@ -153,11 +160,18 @@ fn build_examples(b: *Build, optimize: OptimizeMode, target: Build.ResolvedTarge
153160
const path = b.pathJoin(&.{ "examples", example_name, "main.zig" });
154161

155162
// Create an executable for each example
156-
const exe = b.addExecutable(.{
163+
const exe = b.addExecutable(if (builtin.zig_version.minor == 14) .{
157164
.name = example_name,
158165
.root_source_file = b.path(path),
159166
.target = target,
160167
.optimize = optimize,
168+
} else .{
169+
.name = example_name,
170+
.root_module = b.addModule(example_name, .{
171+
.root_source_file = b.path(path),
172+
.target = target,
173+
.optimize = optimize,
174+
}),
161175
});
162176

163177
// Add the webui module and link against the library

0 commit comments

Comments
 (0)