Documentation
¶
Overview ¶
Package cgo implements CGo by modifying a loaded AST. It does this by parsing the `import "C"` statements found in the source code with libclang and generating stub function and global declarations.
There are a few advantages to modifying the AST directly instead of doing CGo as a preprocessing step, with the main advantage being that debug information is kept intact as much as possible.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Process ¶
func Process(files []*ast.File, dir, importPath string, fset *token.FileSet, cflags []string, goos string) ([]*ast.File, []string, []string, []string, map[string][]byte, []error)
Process extracts `import "C"` statements from the AST, parses the comment with libclang, and modifies the AST to use this information. It returns a newly created *ast.File that should be added to the list of to-be-parsed files, the CGo header snippets that should be compiled (for inline functions), the CFLAGS and LDFLAGS found in #cgo lines, and a map of file hashes of the accessed C header files. If there is one or more error, it returns these in the []error slice but still modifies the AST.
Types ¶
This section is empty.