Git Product home page Git Product logo

wasmer-rust-customabi-example's Introduction

Wasm Custom ABI from Rust

This project showcases:

  1. How to create a WebAssembly module from Rust using a custom ABI
  2. How to use this module from a host environment

Requirements

Rust target wasm32-unknown-unknown. You can install it with rustup target add wasm32-unknown-unknown.

Instructions

First, let's compile our app into a WebAssembly Module.

rustc --target=wasm32-unknown-unknown app.rs

This should have produced a app.wasm file ready to be used anywhere.

The module is defined as:

(module
  (import "customabi" "print" (func $print (type $t0)))
  (import "customabi" "exit" (func $exit (type $t1)))
  ;; ...
)

Now we should be ready to run the app.wasm file our host environment!

cargo run

This will output the following in shell:

Hello, World! from HOST_NAME
Do exit with code 0
Here are the logged calls: ["print", "exit"]

wasmer-rust-customabi-example's People

Contributors

syrusakbary avatar

Stargazers

Tim Kersey avatar Christian Legnitto avatar Owen Ou avatar Xe Iaso avatar muuk avatar Toshiki Teramura avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.