Documentation
¶
Index ¶
- Constants
- Variables
- func AddDLLDirectory(dir string) (func(), error)
- func CString(s string) []byte
- func FindLibrary(name string) string
- func GoString(p uintptr) string
- func Lookup(name string) (uintptr, error)
- func NewCallback(fn any) (cb uintptr, err error)
- func PointerAt(array uintptr, i int) uintptr
- func RegisterFunc(fptr any, addr uintptr)
- type Library
- type LoadError
- type SymbolError
Constants ¶
const Supported = true
Whether this build can load shared libraries
Variables ¶
var ErrNoCallback = errors.New("no C callback support for " + runtime.GOOS + "/" + runtime.GOARCH)
Error for a build that has no trampoline through which C can call a Go function
var ErrNotFound = errors.New("library not found")
Error for a library that no name, path or search turned up
var ErrUnsupported = errors.New("no dynamic library loader for " + runtime.GOOS + "/" + runtime.GOARCH)
Error for a platform this build has no dynamic library loader binding for
Functions ¶
func AddDLLDirectory ¶
Nothing to add outside Windows, the returned function does nothing
func CString ¶
NUL terminated copy of s for a char pointer argument, to be kept referenced for as long as C reads it
func FindLibrary ¶
Soname or path the platform loader resolves for a short library name such as "opus", empty when none is installed
func NewCallback ¶
C function pointer that calls a Go function, never released; an error once the process has made as many as the platform allows
func RegisterFunc ¶
Binds a Go function variable to the C function at an address
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 ¶
Library opened through dlopen by name or path with every symbol bound at once, its symbols visible to libraries loaded later when global
type LoadError ¶
Shared library that could not be opened, with the reason the platform loader gave
type SymbolError ¶
Function or variable a library does not export, with the reason the platform loader gave
func (*SymbolError) Error ¶
func (e *SymbolError) Error() string
Loader's reason, naming the symbol and the library when the reason does not already mention them