// Code generated by hostgen. DO NOT EDIT. package testpkg import ( "context" extism "github.com/extism/go-sdk" ) // RegisterCounterHostFunctions registers Counter service host functions. // The returned host functions should be added to the plugin's configuration. func RegisterCounterHostFunctions(service CounterService) []extism.HostFunction { return []extism.HostFunction{ newCounterCountHostFunction(service), } } func newCounterCountHostFunction(service CounterService) extism.HostFunction { return extism.NewHostFunctionWithStack( "counter_count", func(ctx context.Context, p *extism.CurrentPlugin, stack []uint64) { // Read parameters from stack name, err := p.ReadString(stack[0]) if err != nil { return } // Call the service method value := service.Count(ctx, name) // Write return values to stack stack[0] = extism.EncodeI32(value) }, []extism.ValueType{extism.ValueTypePTR}, []extism.ValueType{extism.ValueTypeI32}, ) }