A mean to attach methods to C structs
Ziggit
A mean to attach methods to C structs
I’m currently in middle of refactoring the API code that I used for my PHP extension. The initial version was very low effort. For text strings I have this in php.zig: pub const String = c.zend_string; And associated functions: pub fn getStringContent(str: *const String) [:0]const u8 { const s: [*]const u8 = @ptrCast(&str.*.val[0]); const len = str.*.len; return @ptrCast(s[0..len]); } pub fn compareStrings(s1: *const String, s2: *const String) bool { const sc1 = getStringCont...
0 comments
No comments yet.