Documentation
¶
Index ¶
- Constants
- func CBool(b bool) int8
- func CSlice[S ~[]E, E any](s S) unsafe.Pointer
- func CString(s string) unsafe.Pointer
- func Call[F ~uintptr](fn F, args ...any)
- func CallRaw(fn uintptr, args ...uintptr) (r1, r2 uintptr, err syscall.Errno)
- func CallRet[T any, F ~uintptr](fn F, args ...any) (ret T)
- func Dlclose(handle uintptr) error
- func Dlopen(path string, mode int) (uintptr, error)
- func Dlsym(handle uintptr, name string) (uintptr, error)
- func Free(p Pointer)
- func GetExternVariant[T any, L ~uintptr](lib L, name string) (pv *T, err error)
- func GoBool[T comparable](v T) bool
- func GoPointer[T any](p uintptr) *T
- func GoSlice[T comparable](p unsafe.Pointer) []T
- func GoSliceN[T any](p unsafe.Pointer, n int) []T
- func GoSliceNTemp[T any](p unsafe.Pointer, n int) []T
- func GoSliceTemp[T comparable](p unsafe.Pointer) []T
- func GoString(s unsafe.Pointer) string
- func GoStringN(s unsafe.Pointer, n int) string
- func GoStringNTemp(s unsafe.Pointer, n int) string
- func GoStringTemp(s unsafe.Pointer) string
- func Length[T comparable](p unsafe.Pointer) (n int)
- func Memcpy(dst, src Pointer, size Sizet)
- func Memset(p Pointer, val int, size Sizet)
- func NewCallback(fn any) uintptr
- func RegisterFunc(pf any, cfn uintptr) (err error)
- func RegisterLibFunc(pf any, lib uintptr, symbol string) (err error)
- func Strlen(s unsafe.Pointer) (n int)
- type Char
- type Double
- type Float
- type Int
- type Intptr
- type LazyLibrary
- type LazySymbol
- type Library
- type Long
- type LongLong
- type Pointer
- type Short
- type Sizet
- type Ssize
- type Symbol
- type Uchar
- type Uint
- type Uintptr
- type Ulong
- type UlongLong
- type Ushort
Constants ¶
const ( RTLD_DEFAULT = purego.RTLD_DEFAULT RTLD_LAZY = purego.RTLD_LAZY RTLD_NOW = purego.RTLD_NOW RTLD_LOCAL = purego.RTLD_LOCAL RTLD_GLOBAL = purego.RTLD_GLOBAL )
Variables ¶
This section is empty.
Functions ¶
func Dlopen ¶
Dlopen examines the dynamic library or bundle file specified by path.
The mode was ignored on Windows.
func GetExternVariant ¶
func GoBool ¶
func GoBool[T comparable](v T) bool
func GoSlice ¶
func GoSlice[T comparable](p unsafe.Pointer) []T
func GoSliceTemp ¶
func GoSliceTemp[T comparable](p unsafe.Pointer) []T
func GoStringTemp ¶
func Length ¶
func Length[T comparable](p unsafe.Pointer) (n int)
Length Get the length of an array ending with zero
func NewCallback ¶
NewCallback converts a Go function to a C function pointer that can be passed to C code as a callback.
On linux/amd64, linux/arm64, darwin/amd64 and darwin/arm64 the full C calling convention is supported, including float32/float64 and struct arguments and return values, following the System V AMD64 and AAPCS64 ABIs. Struct types must have the same memory layout as their C counterpart (add explicit padding fields if needed).
Only a limited number of callbacks may be created in a single Go process, and any memory allocated for these callbacks is never released.
func RegisterFunc ¶
Types ¶
type LazyLibrary ¶
type LazyLibrary struct {
// contains filtered or unexported fields
}
func NewLazyLibrary ¶
func NewLazyLibrary(name string, fallbacks ...string) (l *LazyLibrary)
func (*LazyLibrary) Handle ¶ added in v0.0.3
func (l *LazyLibrary) Handle() uintptr
func (*LazyLibrary) Load ¶
func (l *LazyLibrary) Load() error
func (*LazyLibrary) NewSymbol ¶
func (l *LazyLibrary) NewSymbol(name string) *LazySymbol
type LazySymbol ¶
type LazySymbol struct {
// contains filtered or unexported fields
}
func (*LazySymbol) Addr ¶
func (s *LazySymbol) Addr() uintptr
func (*LazySymbol) CallRaw ¶
func (s *LazySymbol) CallRaw(args ...uintptr) (r1, r2 uintptr, err error)
func (*LazySymbol) Find ¶
func (s *LazySymbol) Find() error