// Complex return type: serialize the host value to JSON and hand back a
// NUL-terminated C string. The caller owns the returned pointer and must
// free it via the C API.
const _json_slice = std.fmt.allocPrint(std.heap.c_allocator, "{f}", .{ std.json.fmt({{ ok_binding }}, .{}) }) catch {
if (out_error) |ptr| ptr.* = null;
return 1;
};
defer std.heap.c_allocator.free(_json_slice);
const _json_cstr = std.heap.c_allocator.dupeZ(u8, _json_slice) catch {
if (out_error) |ptr| ptr.* = null;
return 1;
};
if (out_result) |ptr| ptr.* = @ptrCast(_json_cstr.ptr);
return 0;