cgo

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: BSD-3-Clause Imports: 16 Imported by: 0

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 string, fset *token.FileSet, cflags []string) (*ast.File, []string, []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. If there is one or more error, it returns these in the []error slice but still modifies the AST.

Types

This section is empty.

Jump to

Keyboard shortcuts

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