{"modulePath":"github.com/dlsniper/speech-cpp-go","version":"v0.11.3","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package loader\n\nPackage loader opens speech.cpp's shared library, libspeech, at run time and checks that its C API is one this module was written against.\n\nIt does not use cgo: the library is opened with dlopen (purego) on Unix and LoadLibrary on Windows, from a path the caller gives.\n\n## Constants\n\n```go\nconst (\n\tRequiredMajor = 4\n\tRequiredMinor = 3\n)\n```\nThe C API version this module binds: speech.h of speech.cpp 0.11.3. A library of the same major version and a minor version of at least RequiredMinor is accepted.\n\n## Variables\n\n```go\nvar ErrIncompatibleVersion = errors.New(\"loader: incompatible libspeech API version\")\n```\nErrIncompatibleVersion is the sentinel every \\*VersionError matches with errors.Is.\n\n```go\nvar ErrNoLibrary = errors.New(\"loader: no libspeech in directory\")\n```\nErrNoLibrary is returned when a directory holds no file with one of LibraryFilenames' names.\n\n## Functions\n\n```go\nfunc CheckVersion(path string, major, minor int) error\n```\nCheckVersion returns a \\*VersionError when major.minor is not compatible with RequiredMajor.RequiredMinor: another major version, or a lower minor one. path only names the library in the error.\n\n```go\nfunc LibraryFilenames(goos string) []string\n```\nLibraryFilenames returns the file names libspeech has on goos, the versioned name (its SOVERSION) first.\n\n```go\nfunc Resolve(path string) (string, error)\n```\nResolve returns the library file that path names: path itself when it is a file, or the first of LibraryFilenames(runtime.GOOS) present in it when it is a directory.\n\n## Types\n\n```go\ntype Library struct {\n\t// contains filtered or unexported fields\n}\n```\nLibrary is an open libspeech whose C API version has been checked. Nothing a library hands out may outlive it, so one whose functions are in use stays open for the life of the process; Close is for one that is not.\n\n```go\nfunc Open(path string) (*Library, error)\n```\nOpen opens libspeech at path, a file or a directory holding it, reads speech\\_api\\_version\\_major() and speech\\_api\\_version\\_minor(), and refuses a library whose version CheckVersion refuses, with a \\*VersionError.\n\n```go\nfunc (l *Library) APIVersion() (major, minor int)\n```\nAPIVersion is the C API version the library reported.\n\n```go\nfunc (l *Library) Close() error\n```\nClose closes the library (dlclose, FreeLibrary). It is only for a library none of whose functions or objects are in use, such as one whose symbols could not all be bound. A second Close does nothing. It is not safe to call while another goroutine uses the Library.\n\n```go\nfunc (l *Library) Handle() uintptr\n```\nHandle is the native handle (dlopen's or LoadLibrary's).\n\n```go\nfunc (l *Library) Path() string\n```\nPath is the file that was opened.\n\n```go\nfunc (l *Library) Symbol(name string) (uintptr, error)\n```\nSymbol returns the address of the exported function name.\n\n```go\ntype VersionError struct {\n\tPath          string\n\tFoundMajor    int\n\tFoundMinor    int\n\tRequiredMajor int\n\tRequiredMinor int\n}\n```\nVersionError says that the library's C API version is not one this module runs against.\n\n```go\nfunc (e *VersionError) Error() string\n```\n\n```go\nfunc (e *VersionError) Unwrap() error\n```\nUnwrap makes errors.Is(err, ErrIncompatibleVersion) true.\n\n","path":"github.com/dlsniper/speech-cpp-go/pkg/loader","name":"loader","synopsis":"Package loader opens speech.cpp's shared library, libspeech, at run time and checks that its C API is one this module was written against.","isRedistributable":true}
