forceexport

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: MIT, MIT Imports: 7 Imported by: 0

README

This package is a fork of https://github.com/alangpierce/go-forceexport.

As you might expect, this package is unsafe and fragile and probably shouldn't be used in production, it is mainly for testing purpose.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFuncForCodePtr

func CreateFuncForCodePtr(outFuncPtr any, codePtr uintptr)

CreateFuncForCodePtr accepts a code pointer and creates a function value that uses the pointer. The outFuncPtr 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

FindFuncWithName searches through the moduledata table created by the linker and returns the function's code pointer. If the function does not exist, or is inlined, or inactive (haven't been compiled into the binary), it panics.

func GetFunc

func GetFunc(outFuncPtr any, name string)

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 function does not exist, or is inlined, or inactive (haven't been compiled into the binary), it panics.

func GetType

func GetType(name string) *reflectx.RType

GetType gets the type defined by the given fully-qualified name. If the specified type does not exist, or inactive (haven't been compiled into the binary), it panics.

func ScanType

func ScanType(f func(name string, typ *reflectx.RType))

ScanType scans type information which are available from reflect.typelinks. For each type, it calls f with the type's fully-qualified name and type.

Types

type Func

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

Func is a 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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