Documentation ¶
Overview ¶
Package bind provides tools to generate bindings to use Go from Python.
Index ¶
Constants ¶
const ( // GoHandle is the type to use for the Handle map key, go-side GoHandle = "int64" // CGoHandle is Handle for cgo files CGoHandle = "C.longlong" // PyHandle is within python PyHandle = "int64_t" )
const ( ModeGen BuildMode = "gen" ModeBuild = "build" ModeExe = "exe" ModePkg = "pkg" )
const ( PyBuildPreamble = `` /* 240-byte string literal not displayed */ // 3 = specific package name, 4 = spec pkg path, 5 = doc, 6 = imports PyWrapPreamble = `` /* 631-byte string literal not displayed */ // exe version of preamble -- doesn't need complex code to load _ module // 3 = specific package name, 4 = spec pkg path, 5 = doc, 6 = imports PyWrapExePreamble = `` /* 415-byte string literal not displayed */ GoPkgDefs = `` /* 423-byte string literal not displayed */ // 3 = gencmd, 4 = vm, 5 = libext 6 = extraGccArgs MakefileTemplate = `` /* 1138-byte string literal not displayed */ // exe version of template: 3 = gencmd, 4 = vm, 5 = libext MakefileExeTemplate = `` /* 1167-byte string literal not displayed */ )
3 = libcfg, 4 = GoHandle, 5 = CGoHandle, 6 = all imports, 7 = mainstr, 8 = exe pre C, 9 = exe pre go
Variables ¶
var Packages []*Package
Packages accumulates all the packages processed
Functions ¶
func CmdStrToMakefile ¶ added in v0.3.0
CmdStrToMakefile does what is needed to make the command string suitable for makefiles * removes -output
func GenPyBind ¶ added in v0.3.0
func GenPyBind(mode BuildMode, odir, outname, cmdstr, vm, mainstr, libext, extragccargs string, lang int) error
GenPyBind generates a .go file, build.py file to enable pybindgen to create python bindings, and wrapper .py file(s) that are loaded as the interface to the package with shadow python-side classes mode = gen, build, pkg, exe
func ResetPackages ¶ added in v0.3.0
func ResetPackages()
ResetPackages resets any accumulated packages -- needed when doing tests
Types ¶
type Func ¶
type Func struct {
// contains filtered or unexported fields
}
Func collects information about a go func/method.
type Interface ¶ added in v0.3.0
type Interface struct {
// contains filtered or unexported fields
}
Interface collects information about a go interface.
type Map ¶ added in v0.3.0
type Map struct {
// contains filtered or unexported fields
}
Map collects information about a go map.
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
Package ties types.Package and ast.Package together. Package also collects information about specific types (structs, ifaces, etc)
func NewPackage ¶
NewPackage creates a new Package, tying types.Package and ast.Package together.
func (*Package) ImportPath ¶
ImportPath returns the package import path.
type Protocol ¶
type Protocol int
Protocol encodes the various protocols a python type may implement
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
A Signature represents a (non-builtin) function or method type.
type Slice ¶ added in v0.3.0
type Slice struct {
// contains filtered or unexported fields
}
Slice collects information about a go slice.
type Struct ¶
type Struct struct {
// contains filtered or unexported fields
}
Struct collects information about a go struct.
func (*Struct) FirstEmbed ¶ added in v0.3.0
func (s *Struct) FirstEmbed() *symbol
FirstEmbed returns the first field if it is embedded, supporting convention of placing embedded "parent" types first