Documentation
¶
Overview ¶
Package cguest loads trusted C ABI libraries (lib/plugin/include/ext_plugin_guest.h), including Go -buildmode=c-shared guests, and exchanges frames with them as bytes. It knows nothing of the plugin protocol: what the frames mean, and the limits and deadlines a session applies, belong to the caller (cguest/backend makes it a plugin backend). Native code executes inside the host and cannot be forcibly stopped.
It loads with cgo on Linux, macOS, FreeBSD and Windows, and without cgo through purego on Linux, macOS and Windows for amd64 and arm64; Supported reports whether this build can load at all. The C ABI has no host callbacks, so both loaders implement all of it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalid is a bad path, an oversized frame or a call the guest reported as invalid. ErrInvalid = errors.New("cguest: invalid") // ErrUnsupported is a library this build cannot load or that is not an ABI v1 guest. ErrUnsupported = errors.New("cguest: unsupported") // ErrDenied is a guest that refused a new handle. ErrDenied = errors.New("cguest: denied") // ErrClosed is a call on a closed guest. ErrClosed = errors.New("cguest: closed") )
Functions ¶
Types ¶
type Guest ¶
type Guest struct {
// contains filtered or unexported fields
}
Guest is one handle on a loaded C ABI library. It runs one call at a time.
func Open ¶
Open loads an absolute verified library path, checks ABI v1 and creates an independent guest handle. Library images remain resident for process lifetime, even after errors: dlclose is unsafe for Go runtimes and callbacks. Use immutable revision-specific artifact paths. Cancellation returns promptly but cannot stop native initializers or open; a handle returned later is closed by the outstanding startup goroutine.
func (*Guest) Call ¶
Call sends one frame for operation op (abi.Handshake or abi.Invoke) and returns the guest's frame. A frame larger than abi.MaxFrameBytes is ErrInvalid. When ctx ends first, or the guest fails the call, the guest is closed.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package abi defines the language-neutral ext.plugin C ABI v1 envelope.
|
Package abi defines the language-neutral ext.plugin C ABI v1 envelope. |
|
Package backend runs plugin guests built as C shared libraries (lib/plugin/include/ext_plugin_guest.h), including Go -buildmode=c-shared guests, as a plugin backend.
|
Package backend runs plugin guests built as C shared libraries (lib/plugin/include/ext_plugin_guest.h), including Go -buildmode=c-shared guests, as a plugin backend. |
|
Package guest binds Go guests to the Ext C ABI.
|
Package guest binds Go guests to the Ext C ABI. |