core

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

package core implements core functionality for the generated files this core lib is imported by the generated code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteSlice

func ByteSlice(name []string) **byte

ByteSlice creates a pointer to a byte slice of C strings This function was copied from purego

func CString

func CString(name string) *byte

CString converts a go string to *byte that can be passed to C code. This function was copied from purego

func GFree

func GFree(ptr uintptr)

GFree frees memory allocated by GLib allocation APIs.

func GFreeNullable

func GFreeNullable(ptr uintptr)

GFreeNullable frees a nullable GLib-allocated pointer.

func GStrdup

func GStrdup(s string) uintptr

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

func GStrdupNullable(s *string) uintptr

GStrdupNullable is like GStrdup but accepts a nullable *string.

func GetPaths

func GetPaths(name string) []string

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

func GoString(c uintptr) string

GoString copies a char* to a Go string. This function was copied from purego

func GoStringSlice

func GoStringSlice(c uintptr) []string

GoStringSlice gets a string slice from a char** array This function was copied from purego

func NullableStringToPtr

func NullableStringToPtr(s *string) (uintptr, []byte)

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

func PtrToNullableString(ptr uintptr) *string

PtrToNullableString converts a nullable char* to a Go *string.

func PuregoSafeRegister

func PuregoSafeRegister(fptr interface{}, libs []uintptr, name 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

func SetSharedLibraries(libName string, sharedLibs []string)

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.

func TryGetPaths added in v0.3.0

func TryGetPaths(name string) []string

TryGetPaths is like GetPaths but returns an empty slice instead of panicking. Use this for optional libraries that may not be installed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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