Skip to content

Commit 3c59941

Browse files
committed
feat(ffi): add missing library metadata and free_string exports — issue #88
1 parent 2bb8ba8 commit 3c59941

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

ffi/zig/src/main.zig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,22 @@ export fn proven_free(handle: ?*Handle) void {
8080
clearError();
8181
}
8282

83+
/// Return the library version triple
84+
export fn proven_version_major() u32 { return 1; }
85+
export fn proven_version_minor() u32 { return 1; }
86+
export fn proven_version_patch() u32 { return 0; }
87+
88+
/// Return the FFI ABI version
89+
export fn proven_ffi_abi_version() u32 { return 1; }
90+
91+
/// Free a string allocated by the library
92+
export fn proven_free_string(ptr: ?[*]const u8) void {
93+
const p = ptr orelse return;
94+
// Find the null terminator to determine length for the allocator
95+
const len = std.mem.len(p);
96+
std.heap.c_allocator.free(p[0..len + 1]);
97+
}
98+
8399
//==============================================================================
84100
// Core Operations
85101
//==============================================================================

0 commit comments

Comments
 (0)