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 ¶
- func DecRef(handle CGoHandle)
- func Embed(stru interface{}, embed reflect.Type) interface{}
- func IfaceIsNil(it interface{}) bool
- func IncRef(handle CGoHandle)
- func NonPtrValue(v reflect.Value) reflect.Value
- func NumHandles() int
- func PtrValue(v reflect.Value) reflect.Value
- func VarFromHandle(h CGoHandle, typnm string) interface{}
- func VarFromHandleTry(h CGoHandle, typnm string) (interface{}, error)
- type CGoHandle
- type GoHandle
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 ¶
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 ¶
NonPtrValue returns the non-pointer underlying value
func PtrValue ¶
PtrValue returns the pointer version (Addr()) of the underlying value if the value is not already a Ptr
func VarFromHandle ¶
VarFromHandle gets variable from handle string. Reports error to python but does not return it, for use in inline calls
func VarFromHandleTry ¶
VarFromHandleTry version returns the error explicitly, for use when error can be processed