tinygo

command
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

TinyGo allocation example

This example shows how to pass strings in and out of a Wasm function defined in TinyGo, built with

(cd testdata; tinygo build -scheduler=none -target=wasip1 -buildmode=c-shared -o greet.wasm greet.go)
$ go run greet.go wazy
wasm >> Hello, wazy!
go >> Hello, wazy!

Under the covers, greet.go does a few things of interest:

  • Uses unsafe.Pointer to change a Go pointer to a numeric type.
  • Uses reflect.StringHeader to build back a string from a pointer, len pair.
  • Relies on CGO to allocate memory used to pass data from TinyGo to host.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL