We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8323885 commit 8bad885Copy full SHA for 8bad885
hello-world.py
@@ -3,7 +3,7 @@
3
cffi = FFI()
4
cffi.cdef(
5
"""
6
- void printZ(char* messageZ);
+ void printZ(char* message);
7
8
)
9
hello-world.zig
@@ -1,9 +1,6 @@
1
const std = @import("std");
2
// messageZ must be null-terminated
-export fn printZ(messageZ: [*]u8) void {
- // [*:0]u8 is not allowed by C ABI, cast to right type
- const message = @ptrCast([*:0]u8, messageZ);
-
+export fn printZ(message: [*:0]u8) callconv(.C) void {
std.debug.print("{s}\n", .{message});
}
0 commit comments