All Projects β†’ wasmerio β†’ Wasmer Go

wasmerio / Wasmer Go

Licence: mit
πŸΉπŸ•ΈοΈ WebAssembly runtime for Go

Programming Languages

go
31211 projects - #10 most used programming language
rust
11053 projects
golang
3204 projects

Projects that are alternatives of or similar to Wasmer Go

D3 Wasm Force
A re-implementation of d3-force with WebAssembly.
Stars: ✭ 93 (-93.19%)
Mutual labels:  webassembly, wasm
Dcmjs
dcmjs is a javascript cross-compile of dcmtk (dcmtk.org).
Stars: ✭ 92 (-93.26%)
Mutual labels:  webassembly, wasm
React Vim Wasm
Vim editor embedded in your React web application
Stars: ✭ 77 (-94.36%)
Mutual labels:  webassembly, wasm
Telegram React
Experimental Telegram web client with tdlib, webassembly and react js under the hood
Stars: ✭ 1,332 (-2.42%)
Mutual labels:  webassembly, wasm
Emscripten Docker
Docker image with Emscripten to compile ASM.js and WebAssembly
Stars: ✭ 92 (-93.26%)
Mutual labels:  webassembly, wasm
Fastq.bio
An interactive web tool for quality control of DNA sequencing data
Stars: ✭ 76 (-94.43%)
Mutual labels:  webassembly, wasm
Opus Stream Decoder
Instantly decode Ogg Opus audio streams in chunks with JavaScript & WebAssembly (Wasm)
Stars: ✭ 80 (-94.14%)
Mutual labels:  webassembly, wasm
Web Audio Javascript Webassembly Sdk Interactive Audio
🌐 Superpowered Web Audio JavaScript and WebAssembly SDK for modern web browsers. Allows developers to implement low-latency interactive audio features into web sites and web apps with a friendly Javascript API. https://superpowered.com
Stars: ✭ 68 (-95.02%)
Mutual labels:  webassembly, wasm
Assortedwidgets
OpenGL GUI library
Stars: ✭ 92 (-93.26%)
Mutual labels:  webassembly, wasm
Wasm To Oci
Use OCI registries to distribute WASM modules
Stars: ✭ 83 (-93.92%)
Mutual labels:  webassembly, wasm
Pulsefft
A WebAssembly implementation of the C Fast Fourier Transform library kissFFT
Stars: ✭ 76 (-94.43%)
Mutual labels:  webassembly, wasm
Wasm Forth
A Forth implementation compiling to WebAssembly.
Stars: ✭ 92 (-93.26%)
Mutual labels:  webassembly, wasm
Wagi
Write HTTP handlers in WebAssembly with a minimal amount of work
Stars: ✭ 75 (-94.51%)
Mutual labels:  webassembly, wasm
Wasmer
πŸš€ The leading WebAssembly Runtime supporting WASI and Emscripten
Stars: ✭ 11,047 (+709.3%)
Mutual labels:  webassembly, wasm
Veracruz
Main repository for the Veracruz privacy-preserving compute project.
Stars: ✭ 71 (-94.8%)
Mutual labels:  webassembly, wasm
Doomfire
DOOM fire implementation written in rust
Stars: ✭ 80 (-94.14%)
Mutual labels:  webassembly, wasm
Dockerdot
🐳 dockerdot shows dockerfile dependenciy graph. This is useful to understand how build dockerfile. This uses Go WebAssembly + BuildKit package.
Stars: ✭ 65 (-95.24%)
Mutual labels:  webassembly, wasm
Muze
Composable data visualisation library for web with a data-first approach now powered by WebAssembly
Stars: ✭ 1,153 (-15.53%)
Mutual labels:  webassembly, wasm
Denoflate
WebAssembly powered Deflate/Gzip/Zlib compression for Deno, written in Rust
Stars: ✭ 80 (-94.14%)
Mutual labels:  webassembly, wasm
Draw App
In browser drawing app built in rust / wasm
Stars: ✭ 87 (-93.63%)
Mutual labels:  webassembly, wasm
Wasmer logo

Wasmer Go

Build Status License Go Package API Documentation

Website β€’ Docs β€’ Slack Channel


A complete and mature WebAssembly runtime for Go based on Wasmer.

Features

  • Easy to use: The wasmer API mimics the standard WebAssembly API,
  • Fast: wasmer executes the WebAssembly modules as fast as possible, close to native speed,
  • Safe: All calls to WebAssembly will be fast, but more importantly, completely safe and sandboxed.

Documentation: browse the detailed API documentation full of examples.

Examples as tutorials: browse the examples/ directory, it's the best place for a complete introduction!

Install

To install the library, follow the classical:

$ go get github.com/wasmerio/wasmer-go/wasmer

And you're ready to get fun!

Supported platforms

This library embeds the Wasmer runtime compiled as shared library objects, and so uses cgo to consume it. A set of precompiled shared library objects are provided. Thus this library works (and is tested) on the following platforms:

Platform Architecture Triple Status
Linux amd64 x86_64-unknown-linux-gnu βœ…
aarch64 aarch64-unknown-linux-gnu βœ…
Darwin amd64 x86_64-apple-darwin βœ…
aarch64 aarch64-apple-darwin ⏳
Windows amd64 x86_64-pc-windows-msvc ⏳
What to do if your platform is missing?

Up to now, there is no script to automate that process. We are working on it.

Here are the steps to do that manually:

$ # Build the new Wasmer C API shared object library.
$ cargo build --release
$
$ # Configure cgo.
$ export CGO_CFLAGS="-I$(pwd)/wasmer/packaged/include/"
$ export CGO_LDFLAGS="-Wl,-rpath,$(pwd)/target/release/ -L$(pwd)/target/release/ -lwasmer_go"
$
$ # Run the tests.
$ just test -tags custom_wasmer_runtime

Examples

We highly recommend to read the examples/ directory, which contains a sequence of examples/tutorials. It's the best place to learn by reading examples.

But for the most eager of you, there is a quick toy program in examples/appendices/simple.go, written in Rust:

#[no_mangle]
pub extern "C" fn sum(x: i32, y: i32) -> i32 {
    x + y
}

After compilation to WebAssembly, the examples/appendices/simple.wasm binary is generated.

Then, we can execute it in Go:

package main

import (
	"fmt"
	"io/ioutil"
	wasmer "github.com/wasmerio/wasmer-go/wasmer"
)

func main() {
    wasmBytes, _ := ioutil.ReadFile("simple.wasm")

    engine := wasmer.NewEngine()
    store := wasmer.NewStore(engine)

    // Compiles the module
    module, _ := wasmer.NewModule(store, wasmBytes)

    // Instantiates the module
    importObject := wasmer.NewImportObject()
    instance, _ := wasmer.NewInstance(module, importObject)

    // Gets the `sum` exported function from the WebAssembly instance.
    sum, _ := instance.Exports.GetFunction("sum")

    // Calls that exported function with Go standard values. The WebAssembly
    // types are inferred and values are casted automatically.
    result, _ := sum(5, 37)

    fmt.Println(result) // 42!
}

And then, finally, enjoy by running:

$ go run examples/appendices/simple.go

Testing

Run the tests with the following command:

$ just test

What is WebAssembly?

Quoting the WebAssembly site:

WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable target for compilation of high-level languages like C/C++/Rust, enabling deployment on the web for client and server applications.

About speed:

WebAssembly aims to execute at native speed by taking advantage of common hardware capabilities available on a wide range of platforms.

About safety:

WebAssembly describes a memory-safe, sandboxed execution environment […].

License

The entire project is under the MIT License. Please read the LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].