mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
a working prototype
This commit is contained in:
parent
d8e38ef2ac
commit
a0a0896622
11 changed files with 443 additions and 144 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue