Skip to content

Instantly share code, notes, and snippets.

call $srand
drop
#include <iostream>
int main() {
std::cout << "Hello world!";
}
(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)))
uint64_t add(uint32_t &a, uint32_t &b) {
return a + (uint64_t)b;
}
(func $add (param $0 i32) (param $1 i32) (result i64)
(i64.add
(i64.load32_u (get_local $1))
(i64.load32_u (get_local $0))
)
)
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>,
[dependencies]
fluence = { version = "0.1.7" feature = ["side_module"] }
#[no_mangle]
pub unsafe fn invoke(ptr: *mut u8, len: usize) -> usize {
...
}
#[no_mangle]
pub unsafe fn allocate(size: usize) -> NonNull<u8> {
...
}
[lib]
name = "hello_world"
path = "src/lib.rs"
crate-type = ["cdylib"]
[dependencies]
fluence = { version = "0.1.7" }
[lib]
name = "hello_world"
path = "src/lib.rs"
crate-type = ["cdylib"]
[dependencies]
fluence = { version = "0.1.5" }