Skip to content

tcastelly/moonbit-wasmtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Run MoonBit project with a wasm runtime

The MoonBit "Hello World" project does not work by default with Wasmtime (or other runner).

Try MoonBit

cd moonbit

moon run ./src/main

# Hello, world!

Build the project for wasm

cd moonbit

moon build --target wasm

Try to run with Wasmtime

wasmtime target/wasm/release/build/main/main.wasm                                                                                                                                                                                                 1   master 

# Error: failed to run main module `target/wasm/release/build/main/main.wasm`
# 
# Caused by:
#     0: failed to instantiate "target/wasm/release/build/main/main.wasm"
#     1: unknown import: `spectest::print_char` has not been defined

Build "compatible" wasmtime

Let implement spectest::print_char in wasmtime

cd ext_wasmtime

cargo build --release

Run main.wasm with the extended wasmtime

We have now a compatible wasm runtime

./ext_wasmtime/target/release/ext-wasmtime

# Hello, world!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published