Files
avo/examples/ext
Michael McLoughlin 34ac353c14 all: remove +build tags (#377)
Commit 759be3dad9 bumped our Go
requirement to 1.18 which allows us to drop support for old-style
`+build` tags. This change runs `go fix ./...` to remove them, and
updates some remaining code generators that produced `+build` lines.
2023-03-05 20:30:01 -08:00
..
2019-01-22 22:35:01 -08:00
2023-03-05 20:30:01 -08:00
2019-01-22 22:35:01 -08:00
2019-01-22 22:35:01 -08:00
2019-01-22 22:35:01 -08:00
2019-01-22 22:35:01 -08:00

ext

Demonstrates how to use external types in an avo function signature.

In this case, you will need to write the function stub yourself.

package ext

import "github.com/mmcloughlin/avo/examples/ext/ext"

// StructFieldB returns field B.
func StructFieldB(e ext.Struct) byte

Then in place of the usual TEXT declaration we use Implement to state that we are beginning the definition of a function already declared in the package stub file.

	Package("github.com/mmcloughlin/avo/examples/ext")
	Implement("StructFieldB")
	b := Load(Param("e").Field("B"), GP8())
	Store(b, ReturnIndex(0))
	RET()

Finally, in this case the go:generate line is different since we do not need to generate the stub file.

//go:generate go run asm.go -out ext.s