This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call $srand | |
drop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main() { | |
std::cout << "Hello world!"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import "wasi_unstable" "fd_seek" (func $__wasi_fd_seek (type 15))) | |
(import "wasi_unstable" "fd_close" (func $__wasi_fd_close (type 2))) | |
(import "wasi_unstable" "fd_fdstat_get" (func $__wasi_fd_fdstat_get (type 1))) | |
(import "wasi_unstable" "fd_read" (func $__wasi_fd_read (type 6))) | |
(import "wasi_unstable" "fd_write" (func $__wasi_fd_write (type 6))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint64_t add(uint32_t &a, uint32_t &b) { | |
return a + (uint64_t)b; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(func $add (param $0 i32) (param $1 i32) (result i64) | |
(i64.add | |
(i64.load32_u (get_local $1)) | |
(i64.load32_u (get_local $0)) | |
) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rental! { | |
mod rentals { | |
use super::*; | |
#[rental_mut] | |
pub struct FrankRental { | |
instance: Box<Instance>, | |
allocate: Func<'instance, (i32), i32>, | |
deallocate: Func<'instance, (i32, i32), ()>, | |
invoke: Func<'instance, (i32, i32), i32>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[dependencies] | |
fluence = { version = "0.1.7" feature = ["side_module"] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[no_mangle] | |
pub unsafe fn invoke(ptr: *mut u8, len: usize) -> usize { | |
... | |
} | |
#[no_mangle] | |
pub unsafe fn allocate(size: usize) -> NonNull<u8> { | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[lib] | |
name = "hello_world" | |
path = "src/lib.rs" | |
crate-type = ["cdylib"] | |
[dependencies] | |
fluence = { version = "0.1.7" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[lib] | |
name = "hello_world" | |
path = "src/lib.rs" | |
crate-type = ["cdylib"] | |
[dependencies] | |
fluence = { version = "0.1.5" } |