Skip to content

second-state/WasmEdge-go

Repository files navigation

WasmEdge for Go Package

The WasmEdge is a high performance WebAssembly runtime optimized for server side applications. This project provides a golang package for accessing to WasmEdge.

Getting Started

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/amd64

Developers 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.0

For 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.0

Note: 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.

WasmEdge-go Documentation

Please refer to the API Documentation for details.

Bazel Support on Windows

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.

Example Configuration

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"],
)