WebAssembly "Hello, World!" with Wasmer

Create a project directory.

mkdir wasm-sample
cd wasm-sample

Write hello.c

#include <stdio.h>
int main(int argc, char ** argv) {
  printf("Hello, World!");

Compile to wasm.
I use Docker. You can use it another way if you want to do it. Reference link

docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) \
emscripten/emsdk emcc hello.c -o hello.wasm

Install wasmer.

curl https://get.wasmer.io -sSfL | sh

Let's try it!!

wasmer hello.wasm


Hello, World!

No Comments Yet