1# Using the Wasmtime API 2 3Wasmtime can be used as a library to embed WebAssembly execution support 4within applications. Wasmtime is written in Rust, but bindings are available 5through a C API for a number of other languages too. This chapter has a number 6of examples which come from the Wasmtime repository itself and showcase the 7Rust, C, and C++ embedding APIs. 8 9# Officially supported bindings 10 11The following languages are all developed in the Wasmtime repository itself and 12have tests/documentation in the main repository itself. 13 14## Rust 15 16Wasmtime is itself written in Rust and is available as the [`wasmtime`] crate on 17crates.io. API reference documentation for Wasmtime can be found on 18[docs.rs](https://docs.rs/wasmtime) and includes a number of examples throughout 19the documentation. 20 21[`wasmtime`]: https://crates.io/crates/wasmtime 22 23## C 24 25Wasmtime provides a C API through `libwasmtime.a`, for example. The C API is 26developed/tested in the Wasmtime repository itself and is the main entrypoint of 27all other language support for Wasmtime other than Rust. Note that the C API is 28not always in perfect parity with the Rust API and can lag behind in terms of 29features. This is not intentional, however, and with sufficient development 30resources the two APIs will be kept in-sync. 31 32Documentation for the C API can be found at 33[docs.wasmtime.dev/c-api](https://docs.wasmtime.dev/c-api/). Documentation on 34how to build the C API can be found in the [README of the C API]. Building the C 35API uses CMake to orchestrate the build and Cargo under the hood to build the 36Rust code. 37 38The C API can also be installed through `*-c-api-*` [release artifacts]. 39 40[README of the C API]: https://github.com/bytecodealliance/wasmtime/blob/main/crates/c-api/README.md 41[release artifacts]: https://github.com/bytecodealliance/wasmtime/releases/latest 42 43## C++ 44 45Wasmtime supports C++ as a header-based library layered on top of the C API. The 46C++ API header use the `*.hh` extension and are installed alongside the C API 47meaning that if you install the C API you've got the C++ API as well. The C++ 48API is focused on automating resource management of the C API and providing an 49easier-to-use API on top. 50 51## Bash 52 53Wasmtime is available in Bash through the [`wasmtime` CLI](./cli.md) executable 54and its various subcommands. Source for the `wasmtime` executable is developed 55in the same repository as Wasmtime itself. Installation of `wasmtime` can be 56[found in this documentation](./cli-install.md). 57 58# External bindings to Wasmtime 59 60The following language bindings are all developed outside of the Wasmtime 61repository. Consequently they are not officially supported and may have varying 62levels of support and activity. Note that many of these bindings are in the 63bytecodealliance GitHub organization but are still not tested/developed in-sync 64with the main repository. 65 66## Python 67 68Python bindings for Wasmtime are developed in the [wasmtime-py 69repository](https://github.com/bytecodealliance/wasmtime-py). These bindings are 70built on the C API and developed externally from the main Wasmtime repository so 71updates can lag behind the main repository sometimes in terms of release 72schedule and features. 73 74Python bindings are published to the 75[`wasmtime`](https://pypi.org/project/wasmtime/) package on PyPI. 76 77## Go 78 79Go bindings for Wasmtime are developed in the [wasmtime-go 80repository](https://github.com/bytecodealliance/wasmtime-go). These bindings are 81built on the C API and developed externally from the main Wasmtime repository so 82updates can lag behind the main repository sometimes in terms of release 83schedule and features. 84 85Documentation for the Go API bindings can be found [on 86pkg.go.dev](https://pkg.go.dev/github.com/bytecodealliance/wasmtime-go), and be 87sure to use the version-picker to pick the latest major version which tracks 88Wasmtime's own major versions. 89 90## .NET 91 92The [Wasmtime](https://www.nuget.org/packages/Wasmtime) NuGet package can be 93used to programmatically interact with WebAssembly modules and requires 94[.NET Core SDK 3.0 SDK or later](https://dotnet.microsoft.com/download) 95installed as well. 96 97The [.NET embedding of Wasmtime 98repository](https://github.com/bytecodealliance/wasmtime-dotnet) contains the 99source code for the Wasmtime NuGet package and 100the repository also has more 101[examples](https://github.com/bytecodealliance/wasmtime-dotnet/tree/main/examples) 102as well. 103 104## Ruby 105 106Wasmtime [is available on RubyGems](https://rubygems.org/gems/wasmtime) and can 107be used programmatically to interact with Wasm modules. To learn more, check out 108the [more advanced 109examples](https://github.com/bytecodealliance/wasmtime-rb/tree/main/examples) 110and the [API 111documentation](https://bytecodealliance.github.io/wasmtime-rb/latest/). If you 112have any questions, do not hesitate to open an issue on the [GitHub 113repository](https://github.com/bytecodealliance/wasmtime-rb). 114 115## Elixir 116 117Wasmtime [is available on Hex](https://hex.pm/packages/wasmex) and can be used 118programmatically to interact with Wasm modules. To learn more, check out an 119[another example](https://github.com/tessi/wasmex#example) and the [API 120documentation](https://hexdocs.pm/wasmex/Wasmex.html). If you have any 121questions, do not hesitate to open an issue on the [GitHub 122repository](https://github.com/tessi/wasmex). 123