fibo package icon
lhauspie/fibo

wasi

Public
wasmer run lhauspie/fibo

wasm-fibo

Calculates the fibonacci number of n : Fn

How to

Build the docker image that contains all the tools to build wasm binaries :

$ docker build . -t wasm

Run this docker image by providing the project as volume

$ docker run -it --rm -v $PWD:/project wasm:latest

Run the make commands that you want to build conventional binaries:

$ make compile-cpp # to compile only fibo.cpp to fibo_cpp.exe
$ make compile-rust # to compile only fibo.rs to fibo_rust.exe
$ make compile # to do both previous commands at once

Run the make commands that you want to build Webassembly binaries:

$ make wasm-cpp # to compile only fibo.cpp to fibo_cpp.wasm
$ make wasm-rust # to compile only fibo.rs to fibo_rust.wasm
$ make wasm # to do both previous commands at once

The make clean command will remove all binaries.

Run the wasm file by using node:

node fibo_cpp.js 10

Interesting Links

Tuto and Explorer

https://emscripten.org
https://rustwasm.github.io/book/
https://mbebenita.github.io/WasmExplorer/

Some blog posts

https://medium.com/wasmer/executing-webassembly-in-your-rust-application-d5cd32e8ce46 https://medium.com/wasmer/running-webassembly-from-any-language-5741f6320ccd https://opensource.com/article/19/4/command-line-playgrounds-webassembly https://ariya.io/2019/05/basics-of-memory-access-in-webassembly

Calculates the fibonacci number of n : Fn


Github

Making software universally accessible