Movatterモバイル変換


[0]ホーム

URL:


Wasmtime

    Using the Wasmtime API

    Wasmtime can be used as a library to embed WebAssembly execution supportwithin applications. Wasmtime is written in Rust, but bindings are availablethrough a C API for a number of other languages too. This chapter has a numberof examples which come from the Wasmtime repository itself and showcase theRust, C, and C++ embedding APIs.

    Officially supported bindings

    The following languages are all developed in the Wasmtime repository itself andhave tests/documentation in the main repository itself.

    Rust

    Wasmtime is itself written in Rust and is available as thewasmtime crate oncrates.io. API reference documentation for Wasmtime can be found ondocs.rs and includes a number of examples throughoutthe documentation.

    C

    Wasmtime provides a C API throughlibwasmtime.a, for example. The C API isdeveloped/tested in the Wasmtime repository itself and is the main entrypoint ofall other language support for Wasmtime other than Rust. Note that the C API isnot always in perfect parity with the Rust API and can lag behind in terms offeatures. This is not intentional, however, and with sufficient developmentresources the two APIs will be kept in-sync.

    Documentation for the C API can be found atdocs.wasmtime.dev/c-api. Documentation onhow to build the C API can be found in theREADME of the C API. Building the CAPI uses CMake to orchestrate the build and Cargo under the hood to build theRust code.

    The C API can also be installed through*-c-api-*release artifacts.

    C++

    Wasmtime supports C++ as a header-based library layered on top of the C API. TheC++ API header use the*.hh extension and are installed alongside the C APImeaning that if you install the C API you've got the C++ API as well. The C++API is focused on automating resource management of the C API and providing aneasier-to-use API on top.

    Bash

    Wasmtime is available in Bash through thewasmtime CLI executableand its various subcommands. Source for thewasmtime executable is developedin the same repository as Wasmtime itself. Installation ofwasmtime can befound in this documentation.

    External bindings to Wasmtime

    The following language bindings are all developed outside of the Wasmtimerepository. Consequently they are not officially supported and may have varyinglevels of support and activity. Note that many of these bindings are in thebytecodealliance GitHub organization but are still not tested/developed in-syncwith the main repository.

    Python

    Python bindings for Wasmtime are developed in thewasmtime-pyrepository. These bindings arebuilt on the C API and developed externally from the main Wasmtime repository soupdates can lag behind the main repository sometimes in terms of releaseschedule and features.

    Python bindings are published to thewasmtime package on PyPI.

    Go

    Go bindings for Wasmtime are developed in thewasmtime-gorepository. These bindings arebuilt on the C API and developed externally from the main Wasmtime repository soupdates can lag behind the main repository sometimes in terms of releaseschedule and features.

    Documentation for the Go API bindings can be foundonpkg.go.dev, and besure to use the version-picker to pick the latest major version which tracksWasmtime's own major versions.

    .NET

    TheWasmtime NuGet package can beused to programmatically interact with WebAssembly modules and requires.NET Core SDK 3.0 SDK or laterinstalled as well.

    The.NET embedding of Wasmtimerepository contains thesource code for the Wasmtime NuGet package andthe repository also has moreexamplesas well.

    Ruby

    Wasmtimeis available on RubyGems and canbe used programmatically to interact with Wasm modules. To learn more, check outthemore advancedexamplesand theAPIdocumentation. If youhave any questions, do not hesitate to open an issue on theGitHubrepository.

    Elixir

    Wasmtimeis available on Hex and can be usedprogrammatically to interact with Wasm modules. To learn more, check out ananother example and theAPIdocumentation. If you have anyquestions, do not hesitate to open an issue on theGitHubrepository.


    [8]ページ先頭

    ©2009-2025 Movatter.jp