native

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 16 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.

Documentation

Overview

Native libraries speech runs on, loaded at run time without cgo: PortAudio, the speech engine and the wake word engines

Index

Constants

View Source
const Supported = true

Whether this build can load shared libraries

Variables

View Source
var ErrNoCallback = errors.New("this build of icebath can't take calls from libraries on " + runtime.GOOS + "/" + runtime.GOARCH)

No trampoline through which C can call a Go function in this build

View Source
var ErrNotFound = errors.New("the library was not found")

No library turned up for a name, path or search

View Source
var ErrUnsupported = errors.New("this build of icebath can't load libraries on " + runtime.GOOS + "/" + runtime.GOARCH)

No dynamic library loader for this platform

Functions

func At

func At[T any](addr uintptr) *T

Typed pointer of a C address

func CString

func CString(s string) []byte

NUL terminated copy of s for a char pointer argument, kept referenced as long as C reads it

func Chars

func Chars(held *[][]byte, s string) *byte

Pointer to the first byte of a NUL terminated copy, nil for the empty string

func Find

func Find(name string) string

Soname or path the platform loader resolves for a short library name such as portaudio, empty when none is installed

func Floats

func Floats(addr uintptr, n int32) []float32

Copy of n float samples of library memory

func GoString

func GoString(p uintptr) string

Copy of the NUL terminated C string at an address, empty for a null pointer

func Lookup

func Lookup(name string) (uintptr, error)

Address of a symbol in any library already loaded into the process

func NewCallback

func NewCallback(fn any) (cb uintptr, err error)

C function pointer that calls a Go function, never released; an error once the process has made as many as the platform allows

func PointerAt

func PointerAt(array uintptr, i int) uintptr

Pointer sized value at index i of a C array of pointers

func RegisterFunc

func RegisterFunc(fptr any, addr uintptr)

func Text

func Text(p *byte) string

Copy of a C string a field points at, empty for nil

Types

type Library

type Library struct {
	// contains filtered or unexported fields
}

One loaded shared library, kept loaded for the life of the process

func Open

func Open(name string, global bool) (*Library, error)

Library opened with every symbol bound at once, its symbols visible to libraries loaded later when global

func (*Library) Bind

func (l *Library) Bind(fptr any, name string) error

Binds a Go function variable to the library's function of the name

func (*Library) BindAll

func (l *Library) BindAll(table map[string]any) error

Binds every function variable of the table, binding none when the library lacks one

func (*Library) Symbol

func (l *Library) Symbol(name string) (uintptr, error)

type LoadError

type LoadError struct {
	Name string
	Err  error
}

A shared library that could not be opened, with the loader's reason

func (*LoadError) Error

func (e *LoadError) Error() string

func (*LoadError) Unwrap

func (e *LoadError) Unwrap() error

type SymbolError

type SymbolError struct {
	Library string
	Symbol  string
	Err     error
}

A function or variable a library does not export

func (*SymbolError) Error

func (e *SymbolError) Error() string

func (*SymbolError) Unwrap

func (e *SymbolError) Unwrap() error

Jump to

Keyboard shortcuts

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