fix: bitcode functions needed the str namespace not num

This commit is contained in:
rvcas 2021-12-01 16:40:56 -05:00
parent 0d74daf7d9
commit d6ab0b6aa4
2 changed files with 11 additions and 3 deletions

View file

@ -32,8 +32,12 @@ pub fn exportParseInt(comptime T: type, comptime name: []const u8) void {
pub fn exportParseFloat(comptime T: type, comptime name: []const u8) void {
comptime var f = struct {
fn func(input: T, buf: []const u8) callconv(.C) bool {
return std.fmt.parseFloat(T, buf);
fn func(input: T, buf: RocStr) callconv(.C) NumParseResult(T) {
if (std.fmt.parseFloat(T, buf.asSlice())) |success| {
return .{ .errorcode = 0, .value = success };
} else |err| {
return .{ .errorcode = 1, .value = 0 };
}
}
}.func;
@export(f, .{ .name = name ++ @typeName(T), .linkage = .Strong });