memmod

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: GPL-3.0, MIT Imports: 14 Imported by: 0

README

Memmod

Fork of Wireguard's memmod module

Documentation

Index

Constants

View Source
const MaxExportArguments = 3

MaxExportArguments is the maximum number of machine-word arguments accepted by CallExportWithArgs on every supported platform.

Variables

View Source
var ErrDependencyNotFound = errors.New("dependency library not found")

ErrDependencyNotFound is returned by a DependencyReader when an imported library cannot be found in any of its configured search locations.

View Source
var ErrGoExportArgumentsUnsupported = errors.New("memmod: CallExportWithArgs is not supported for Go c-shared images")

ErrGoExportArgumentsUnsupported reports that CallExportWithArgs was used on a Go c-shared image. Use CallExport for its zero-argument exports instead.

Functions

This section is empty.

Types

type Dependency added in v0.0.4

type Dependency struct {
	Data []byte
	Path string
}

Dependency contains the bytes and canonical path of a resolved import.

type DependencyReader added in v0.0.4

type DependencyReader func(DependencyRequest) (Dependency, error)

DependencyReader resolves and reads an imported application library. Implementations must return the path whose bytes they read so nested relative imports can be resolved from the dependency's own directory. Platform backends may bypass the reader for known native runtime libraries. Returning an error that wraps ErrDependencyNotFound allows a backend to use its native system-library fallback; other errors are terminal.

type DependencyRequest added in v0.0.4

type DependencyRequest struct {
	Name         string
	ImporterPath string
	SearchPaths  []string
}

DependencyRequest describes one shared-library import discovered while a recursive load graph is being built.

type Module

type Module struct {
	// contains filtered or unexported fields
}

func LoadLibrary

func LoadLibrary(data []byte) (*Module, error)

func LoadLibraryRecursive added in v0.0.4

func LoadLibraryRecursive(data []byte, origin string, reader DependencyReader) (_ *Module, retErr error)

LoadLibraryRecursive maps an ELF root and each non-system DT_NEEDED dependency into one private Reflektor load group. The legacy LoadLibrary path intentionally remains separate and continues to resolve dependencies through the process loader.

func (*Module) CallExport

func (module *Module) CallExport(name string) error

func (*Module) CallExportWithArgs added in v0.0.4

func (module *Module) CallExportWithArgs(name string, args ...uintptr) (uintptr, error)

CallExportWithArgs resolves and calls an exported native C/Rust function with up to MaxExportArguments machine-word arguments and returns the value from the platform's primary return register. Go c-shared callers must use CallExport instead.

func (*Module) Free

func (module *Module) Free()

func (*Module) ProcAddressByName

func (module *Module) ProcAddressByName(name string) (uintptr, error)

func (*Module) ProcAddressByOrdinal

func (module *Module) ProcAddressByOrdinal(ordinal uint16) (uintptr, error)

Jump to

Keyboard shortcuts

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