a working prototype

This commit is contained in:
Folkert 2021-08-15 23:20:05 +02:00
parent d8e38ef2ac
commit a0a0896622
11 changed files with 443 additions and 144 deletions

View file

@ -62,10 +62,21 @@ pub fn dealloc(c_ptr: [*]u8, alignment: u32) void {
}
// must export this explicitly because right now it is not used from zig code
pub export fn panic(c_ptr: *c_void, alignment: u32) void {
pub fn panic(c_ptr: *c_void, alignment: u32) callconv(.C) void {
return @call(.{ .modifier = always_inline }, roc_panic, .{ c_ptr, alignment });
}
// indirection because otherwise zig creats an alias to the panic function which our LLVM code
// does not know how to deal with
pub fn test_panic(c_ptr: *c_void, alignment: u32) callconv(.C) void {
const cstr = @ptrCast([*:0]u8, c_ptr);
// const stderr = std.io.getStdErr().writer();
// stderr.print("Roc panicked: {s}!\n", .{cstr}) catch unreachable;
std.c.exit(1);
}
pub const Inc = fn (?[*]u8) callconv(.C) void;
pub const IncN = fn (?[*]u8, u64) callconv(.C) void;
pub const Dec = fn (?[*]u8) callconv(.C) void;