Skip to content

Commit 8bad885

Browse files
committed
simplified hello-world
1 parent 8323885 commit 8bad885

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

hello-world.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
cffi = FFI()
44
cffi.cdef(
55
"""
6-
void printZ(char* messageZ);
6+
void printZ(char* message);
77
"""
88
)
99

hello-world.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
const std = @import("std");
22

33
// messageZ must be null-terminated
4-
export fn printZ(messageZ: [*]u8) void {
5-
// [*:0]u8 is not allowed by C ABI, cast to right type
6-
const message = @ptrCast([*:0]u8, messageZ);
7-
4+
export fn printZ(message: [*:0]u8) callconv(.C) void {
85
std.debug.print("{s}\n", .{message});
96
}

0 commit comments

Comments
 (0)