ffi

package module
v0.1.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 4 Imported by: 8

README

ffi

Go Reference

A libffi wrapper for purego.

Documentation

Index

Constants

View Source
const (
	Void = iota
	Int
	Float
	Double
	Longdouble
	Uint8
	Sint8
	Uint16
	Sint16
	Uint32
	Sint32
	Uint64
	Sint64
	Struct
	Pointer
	Complex
)

Variables

View Source
var (
	TypeVoid              = Type{1, 1, 0, nil}
	TypeUint8             = Type{1, 1, 5, nil}
	TypeSint8             = Type{1, 1, 6, nil}
	TypeUint16            = Type{2, 2, 7, nil}
	TypeSint16            = Type{2, 2, 8, nil}
	TypeUint32            = Type{4, 4, 9, nil}
	TypeSint32            = Type{4, 4, 10, nil}
	TypeUint64            = Type{8, 8, 11, nil}
	TypeSint64            = Type{8, 8, 12, nil}
	TypeFloat             = Type{4, 4, 2, nil}
	TypeDouble            = Type{8, 8, 3, nil}
	TypePointer           = Type{8, 8, 14, nil}
	TypeLongdouble        = Type{16, 16, 4, nil}
	TypeComplexFloat      = Type{8, 4, 15, &[]*Type{&TypeFloat, nil}[0]}
	TypeComplexDouble     = Type{16, 8, 15, &[]*Type{&TypeDouble, nil}[0]}
	TypeComplexLongdouble = Type{32, 16, 15, &[]*Type{&TypeLongdouble, nil}[0]}
)

Functions

func Call

func Call(cif *Cif, fn uintptr, rValue unsafe.Pointer, aValues []unsafe.Pointer)

Types

type Abi

type Abi uint32
const (
	DefaultAbi Abi = 2
)

type Cif

type Cif struct {
	Abi      uint32
	NArgs    uint32
	ArgTypes **Type
	RType    *Type
	Bytes    uint32
	Flags    uint32
}

type Status

type Status uint32
const (
	OK Status = iota
	BadTypedef
	BadAbi
	BadArgType
)

func PrepCif

func PrepCif(cif *Cif, abi Abi, nArgs uint32, rType *Type, aTypes []*Type) Status

type Type

type Type struct {
	Size      uint64
	Alignment uint16
	Type      uint16
	Elements  **Type
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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