What's the cost of a C facade?
Ziggit
What's the cost of a C facade?
Imagine you have a zig program that’s called from the outside and it’s contact point looks like this: fn onEvent(opaque_self: ?*anyopaque) callconv(.c) void { const self: *Self = @ptrCast(@alignCast(opaque_self.?)); // handle here } One option is to just use that in the regular flow, and another, which I’m inclined to do, is to create a layer so the ugly code is contained: // Bridge.zig fn onEvent(opaque_program_ptr: ?*anyopaque) callconv(.c) void { const program: *Program = @ptr...
0 comments
No comments yet.