plugin

command
v0.4.22 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

examples/wasm_plugin/plugin/fib.go A WebAssembly plugin for Fibonacci calculation.

IMPORTANT: This MUST be built with TinyGo, not standard Go!

Build with TinyGo:

tinygo build -o fib.wasm -target=wasi fib.go

Standard Go's GOOS=wasip1 does NOT work for plugins because:

  1. When main() returns, Go calls proc_exit(0) which closes the module
  2. Even with select{} in main, there's a runtime check that prevents exported functions from being called until _start completes

TinyGo uses a different architecture that allows exported functions to remain callable after initialization.

Jump to

Keyboard shortcuts

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