The WasmEdge is a high performance WebAssembly runtime optimized for server side applications. This project provides a golang package for accessing to WasmEdge.
- For a complete tutorial, please read the article Extend Your Golang App with Embedded WebAssembly Functions in WasmEdge, which demonstrates how to embed a Wasm function and how to embed a full Wasm program from the Golang app.
- WasmEdge in real-time data strems: AI Inference for Real-time Data Streams with WasmEdge and YoMo
- For more examples, please go to the WasmEdge-go-examples repo. Contributing your own example is much appreciated.
The WasmEdge-go requires golang version >= 1.22. Please check your golang version before installation.
Developers can download golang here.
$ go version
go version go1.23.1 linux/amd64Developers must install the WasmEdge shared library with the same WasmEdge-go release version.
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -v 0.14.0For the developers need the WasmEdge-TensorFlow or WasmEdge-Image plug-ins for WasmEdge-go, please install the WasmEdge with the corresponding plug-ins:
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- --plugins wasmedge_tensorflow wasmedge_tensorflowlite wasmedge_image -v 0.14.0Note: Please refer to the install guide for plug-ins to check that you've installed the plug-ins with their dependencies.
For examples, please refer to the example repository.
Please refer to the API Documentation for details.
To use this library with Bazel on Windows, you can define the WasmEdge C library as a local dependency. Below is an example of how to configure this in your project.
load("@bazel_tools//tools/build_defs/cc:cc_import.bzl", "cc_import")
cc_import(
name = "libwasmedge",
shared_library = "C:/wasmedge/bin/wasmedge.dll",
interface_library = "C:/wasmedge/lib/wasmedge.lib",
system_provided = False,
)
cc_library(
name = "wasmedge_c",
hdrs = [":wasmedge_headers"],
deps = [":libwasmedge"],
includes = ["C:/wasmedge/include"],
visibility = ["//visibility:public"],
)