ffi

package
v0.0.0-...-9853328 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ABIFirst   ffiABI = C.FFI_FIRST_ABI
	ABIDefault ffiABI = C.FFI_DEFAULT_ABI
	ABILast    ffiABI = C.FFI_LAST_ABI
)
View Source
const (
	FFIStatusOk         ffiStatus = C.FFI_OK
	FFIStatusBadTypeDef ffiStatus = C.FFI_BAD_TYPEDEF
	FFIStatusBadAbi     ffiStatus = C.FFI_BAD_ABI
)
View Source
const NilPtr uintptr = 0

Variables

View Source
var Archive *typeArchive
View Source
var (
	ErrFieldNoExist error = errors.New("field no exist")
)
View Source
var PtrSize = unsafe.Sizeof(NilPtr)

Functions

func LoadFFI

func LoadFFI(yocks yocki.YockScheduler)

func New

func New() *yockffi

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder() *Builder

func (*Builder) AddBool

func (b *Builder) AddBool(name string) *Builder

func (*Builder) AddFloat64

func (b *Builder) AddFloat64(name string) *Builder

func (*Builder) AddInt

func (b *Builder) AddInt(name string) *Builder

func (*Builder) AddInt64

func (b *Builder) AddInt64(name string) *Builder

func (*Builder) AddString

func (b *Builder) AddString(name string) *Builder

func (*Builder) Build

func (b *Builder) Build() *Struct

type Cif

type Cif struct {
	// contains filtered or unexported fields
}

func NewCif

func NewCif(fPtr unsafe.Pointer, rType Type, aTypes ...Type) (cif *Cif, err error)

func (*Cif) Call

func (cif *Cif) Call(args ...any) *Result

type FFI_FN

type FFI_FN = *[0]byte

type Field

type Field struct {
	Name string
	Type string
}

type Function

type Function struct {
	// contains filtered or unexported fields
}

func NewFunction

func NewFunction(cif *Cif, outType reflect.Type) *Function

func (*Function) Call

func (obj *Function) Call(rawArgs []reflect.Value) []reflect.Value

type Instance

type Instance struct {
	// contains filtered or unexported fields
}

func (*Instance) Addr

func (i *Instance) Addr() interface{}

func (Instance) Field

func (in Instance) Field(name string) (reflect.Value, error)

func (*Instance) Interface

func (i *Instance) Interface() interface{}

func (*Instance) SetBool

func (in *Instance) SetBool(name string, value bool)

func (*Instance) SetFloat64

func (in *Instance) SetFloat64(name string, value float64)

func (*Instance) SetInt

func (in *Instance) SetInt(name string, value int)

func (*Instance) SetInt64

func (in *Instance) SetInt64(name string, value int64)

func (*Instance) SetString

func (in *Instance) SetString(name, value string)

type Lib

type Lib struct {
	// contains filtered or unexported fields
}

func NewLibray

func NewLibray(name string) (lib Lib, err error)

func (*Lib) Func

func (lib *Lib) Func(name string, rType string, argTypes []string) callableFunction

func (*Lib) RawFunc

func (lib *Lib) RawFunc(
	name string, rType string, argTypes []string,
	go_rtype *[]reflect.Type, go_args *[]reflect.Type,
	ffi_args *[]Type) reflect.Value

type Record

type Record = Type

type Result

type Result struct {
	// contains filtered or unexported fields
}

func (*Result) Double

func (res *Result) Double() float64

func (*Result) Float

func (res *Result) Float() float32

func (*Result) Int

func (res *Result) Int() int

func (*Result) Int16

func (res *Result) Int16() int16

func (*Result) Int32

func (res *Result) Int32() int32

func (*Result) Int64

func (res *Result) Int64() int64

func (*Result) Int8

func (res *Result) Int8() int8

func (*Result) Pointer

func (res *Result) Pointer() unsafe.Pointer

func (*Result) String

func (res *Result) String() string

func (*Result) Uint

func (res *Result) Uint() uint

func (*Result) Uint16

func (res *Result) Uint16() uint16

func (*Result) Uint32

func (res *Result) Uint32() uint32

func (*Result) Uint64

func (res *Result) Uint64() uint64

func (*Result) Uint8

func (res *Result) Uint8() uint8

type Struct

type Struct struct {
	// contains filtered or unexported fields
}

func (Struct) New

func (s Struct) New() *Instance

type Type

type Type interface {
	// contains filtered or unexported methods
}

func NewStructType

func NewStructType(name string, fields []Field) Type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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