Documentation
¶
Overview ¶
package core implements core functionality for the generated files this core lib is imported by the generated code
Index ¶
- func ByteSlice(name []string) **byte
- func CString(name string) *byte
- func GFree(ptr uintptr)
- func GFreeNullable(ptr uintptr)
- func GStrdup(s string) uintptr
- func GStrdupNullable(s *string) uintptr
- func GetPaths(name string) []string
- func GoString(c uintptr) string
- func GoStringSlice(c uintptr) []string
- func LazyRegister(target any, library, symbol string, optional bool) bool
- func LibraryAvailable(library string) bool
- func NullableStringToPtr(s *string) (uintptr, []byte)
- func PtrToNullableString(ptr uintptr) *string
- func PuregoSafeRegister(fptr interface{}, libs []uintptr, name string)
- func SetPackageName(libName, pkgName string)
- func SetSharedLibraries(libName string, sharedLibs []string)
- func TryGetPaths(name string) []string
- type LazyResolver
- type LibraryOpener
- type LibraryPathResolver
- type SymbolResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteSlice ¶
ByteSlice creates a pointer to a byte slice of C strings This function was copied from purego
func CString ¶
CString converts a go string to *byte that can be passed to C code. This function was copied from purego
func GFreeNullable ¶
func GFreeNullable(ptr uintptr)
GFreeNullable frees a nullable GLib-allocated pointer.
func GStrdup ¶
GStrdup allocates a C-owned copy of a Go string using g_strdup. The returned pointer must be freed with g_free by the receiver or callee.
func GStrdupNullable ¶
GStrdupNullable is like GStrdup but accepts a nullable *string.
func GetPaths ¶
GetPaths gets all shared object files from a library name and panics if no matching library can be found. TODO: Hardcode a library shared object with linker -X flag. This is useful for packaging.
func GoString ¶
GoString copies a char* to a Go string. This function was copied from purego
func GoStringSlice ¶
GoStringSlice gets a string slice from a char** array This function was copied from purego
func LazyRegister ¶
LazyRegister publishes a generated function's native symbol on its first call. Required-library failures panic; optional-library failures return false.
func LibraryAvailable ¶
LibraryAvailable reports whether an optional library can be opened. The open result, including failure, is shared with LazyRegister.
func NullableStringToPtr ¶
NullableStringToPtr converts a nullable Go string to a C string pointer. The caller must call runtime.KeepAlive(backing) after the C call completes.
func PtrToNullableString ¶
PtrToNullableString converts a nullable char* to a Go *string.
func SetPackageName ¶
func SetPackageName(libName, pkgName string)
SetPackageName registers a pkg-config package name for a library. This is used by the code generator to set package names from GIR files. It won't override existing entries to preserve defaults.
func SetSharedLibraries ¶
SetSharedLibraries registers shared library names for a library. This is used by the code generator to set library names from GIR files. It won't override existing entries to preserve defaults.
Types ¶
type LazyResolver ¶
type LazyResolver struct {
// contains filtered or unexported fields
}
LazyResolver safely caches library opens and symbol publication. It is safe for concurrent use. Its injected dependencies make resolution deterministic in tests.
func NewLazyResolver ¶
func NewLazyResolver(paths LibraryPathResolver, opener LibraryOpener, resolve SymbolResolver) *LazyResolver
NewLazyResolver constructs an isolated lazy resolver. All dependencies must be non-nil.
func (*LazyResolver) Register ¶
func (r *LazyResolver) Register(target any, library, symbol string) error
Register resolves and publishes symbol into target once. Library and symbol failures are cached as well as successful resolutions.
func (*LazyResolver) RegisterOptional ¶
func (r *LazyResolver) RegisterOptional(target any, library, symbol string) bool
RegisterOptional is Register for optional libraries. It reports whether the symbol was published and caches an unavailable-library failure.
type LibraryOpener ¶
LibraryOpener opens a shared library path and returns its handle.
type LibraryPathResolver ¶
LibraryPathResolver returns the candidate paths for a named library.
Source Files
¶
- core.go
- fastcall.go