mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
generate signature for foreign symbols
This commit is contained in:
parent
4b8392696e
commit
a6e39e66f1
8 changed files with 75 additions and 31 deletions
|
@ -3,4 +3,4 @@ platform folkertdev/foo
|
|||
requires [ main ]
|
||||
imports []
|
||||
effects
|
||||
{ putChar Int -> Effect {} }
|
||||
{ putChar Int -> Effect {}, putLine Str -> Effect {} }
|
||||
|
|
|
@ -2,7 +2,8 @@ app Main provides [ main ] imports [ Effect ]
|
|||
|
||||
main : Effect.Effect {} as Fx
|
||||
main =
|
||||
e = Effect.putChar 69
|
||||
d = Effect.putChar 68
|
||||
|
||||
e |> Effect.after \{} -> d
|
||||
|
||||
Effect.putLine "Hello"
|
||||
|> Effect.after \{} -> Effect.putChar 87
|
||||
# |> Effect.after \{} -> Effect.putLine "orld"
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use roc_std::alloca;
|
||||
use roc_std::RocCallResult;
|
||||
use roc_std::RocStr;
|
||||
use std::alloc::Layout;
|
||||
use std::time::SystemTime;
|
||||
|
||||
|
@ -25,6 +26,15 @@ pub fn roc_fx_putChar(foo: i64) -> () {
|
|||
()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn roc_fx_putLine(line: RocStr) -> () {
|
||||
let bytes = line.as_slice();
|
||||
let string = unsafe { std::str::from_utf8_unchecked(bytes) };
|
||||
println!("{}", string);
|
||||
|
||||
()
|
||||
}
|
||||
|
||||
unsafe fn call_the_closure(function_pointer: *const u8, closure_data_ptr: *const u8) -> i64 {
|
||||
let size = size_Fx() as usize;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue