Documentation
¶
Overview ¶
Package capigen generates raw CGo binding packages from spec YAML and manifest configuration. It produces the capi/{module}/ packages that idiomgen-generated code imports.
Index ¶
Constants ¶
const BaseAPILevel = 35
BaseAPILevel is the default Android API level. Functions at or below this level go into the main generated file; functions above it are emitted into separate build-tagged files.
Variables ¶
This section is empty.
Functions ¶
func ExportName ¶
ExportName returns an exported Go identifier from a C name. Strips leading underscores and capitalizes the first letter. If the name is all underscores, returns it unchanged.
func GeneratePackage ¶
func GeneratePackage( spec *specmodel.Spec, manifest *Manifest, outDir string, apiLevels ...map[string]int, ) error
GeneratePackage generates a complete capi/ Go package from the spec and manifest. It writes doc.go, types.go, const.go, cgo_helpers.go, cgo_helpers.h, and {module}.go into outDir.
apiLevels is an optional map from C function name to the minimum Android API level required. Functions above BaseAPILevel are placed in separate files with //go:build android_ndk{N} tags.
Types ¶
type Manifest ¶
type Manifest struct {
Generator struct {
PackageName string `yaml:"PackageName"`
PackageDescription string `yaml:"PackageDescription"`
Includes []string `yaml:"Includes"`
FlagGroups []FlagGroup `yaml:"FlagGroups"`
ExcludeFunctions []string `yaml:"ExcludeFunctions"`
} `yaml:"GENERATOR"`
}
Manifest holds the relevant manifest fields for capi package generation.