Skip to content

Commit

Permalink
cmd/compile: document go:wasmimport directive
Browse files Browse the repository at this point in the history
Fixes golang#64972

Change-Id: I784a8728afbdef9736681d56f0a79c82a00609d6
GitHub-Last-Rev: bf158db
GitHub-Pull-Request: golang#64991
Reviewed-on: https://go-review.googlesource.com/c/go/+/554455
Reviewed-by: Achille Roussel <[email protected]>
Reviewed-by: Johan Brandhorst-Satzkorn <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
Reviewed-by: Austin Clements <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
  • Loading branch information
mauri870 authored and ezz-no committed Feb 17, 2024
1 parent 4de7ea9 commit 14408ad
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/cmd/compile/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,5 +295,27 @@ The declaration of lower.f may also have a linkname directive with a
single argument, f. This is optional, but helps alert the reader that
the function is accessed from outside the package.
//go:wasmimport importmodule importname
The //go:wasmimport directive is wasm-only and must be followed by a
function declaration.
It specifies that the function is provided by a wasm module identified
by ``importmodule`` and ``importname``.
//go:wasmimport a_module f
func g()
The types of parameters and return values to the Go function are translated to
Wasm according to the following table:
Go types Wasm types
int32, uint32 i32
int64, uint64 i64
float32 f32
float64 f64
unsafe.Pointer i32
Any other parameter types are disallowed by the compiler.
*/
package main

0 comments on commit 14408ad

Please sign in to comment.