gopyh

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package gopyh provides the variable handle manager for gopy. The handles map can NOT be globally shared in C because it must use interface{} values that can change location via GC. In effect, each gopy package must be thought of as a completely separate Go instance, and there can be NO sharing of anything between them, because they fundamentally live in different .so libraries. Thus, we must ensure that all handles used within a package are registered within that same package -- this means python users typically will import a single package, which exports all the relevant functionality as needed. Any further packages cannot share anything other than basic types (int, string etc).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecRef

func DecRef(handle CGoHandle)

DecRef decrements the reference count for the specified handle and removes it if the reference count goes to zero.

func Embed

func Embed(stru interface{}, embed reflect.Type) interface{}

Embed returns the embedded struct (in first field only) of given type within given struct

func IfaceIsNil

func IfaceIsNil(it interface{}) bool

IfaceIsNil returns true if interface or value represented by interface is nil

func IncRef

func IncRef(handle CGoHandle)

IncRef increments the reference count for the specified handle.

func NonPtrValue

func NonPtrValue(v reflect.Value) reflect.Value

NonPtrValue returns the non-pointer underlying value

func NumHandles

func NumHandles() int

NumHandles returns the number of handles in use.

func PtrValue

func PtrValue(v reflect.Value) reflect.Value

PtrValue returns the pointer version (Addr()) of the underlying value if the value is not already a Ptr

func VarFromHandle

func VarFromHandle(h CGoHandle, typnm string) interface{}

VarFromHandle gets variable from handle string. Reports error to python but does not return it, for use in inline calls

func VarFromHandleTry

func VarFromHandleTry(h CGoHandle, typnm string) (interface{}, error)

VarFromHandleTry version returns the error explicitly, for use when error can be processed

Types

type CGoHandle

type CGoHandle int64

func Register

func Register(typnm string, ifc interface{}) CGoHandle

Register registers a new variable instance.

type GoHandle

type GoHandle int64

GoHandle is the type for the handle

Jump to

Keyboard shortcuts

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