forceexport

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFuncForCodePtr

func CreateFuncForCodePtr(outFuncPtr interface{}, codePtr uintptr)

CreateFuncForCodePtr is given a code pointer and creates a function value that uses that pointer. The outFun argument should be a pointer to a function of the proper type (e.g. the address of a local variable), and will be set to the result function value.

func FindFuncWithName

func FindFuncWithName(name string) (uintptr, error)

FindFuncWithName searches through the moduledata table created by the linker and returns the function's code pointer. If the function was not found, it returns an error. Since the data structures here are not exported, we copy them below (and they need to stay in sync or else things will fail catastrophically).

func GetFunc

func GetFunc(outFuncPtr interface{}, name string) error

GetFunc gets the function defined by the given fully-qualified name. The outFuncPtr parameter should be a pointer to a function with the appropriate type (e.g. the address of a local variable), and is set to a new function value that calls the specified function. If the specified function does not exist, outFuncPtr is not set and an error is returned.

Types

type Func

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

Convenience struct for modifying the underlying code pointer of a function value. The actual struct has other values, but always starts with a code pointer.

type Moduledata

type Moduledata struct {
	// contains filtered or unexported fields
}
var Firstmoduledata Moduledata

Jump to

Keyboard shortcuts

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