Documentation
¶
Index ¶
Constants ¶
const RTLD_DEFAULT = ^uintptr(1)
const RTLD_GLOBAL = 0x8
Variables ¶
This section is empty.
Functions ¶
func Dlclose ¶
Dlclose decrements the reference count on the dynamic library handle. If the reference count drops to zero and no other loaded libraries use symbols in it, then the dynamic library is unloaded. Dlclose returns false on success, and true on error.
func Dlerror ¶
func Dlerror() string
Dlerror returns a human-readable string describing the most recent error that occurred from Dlopen, Dlsym or Dlclose since the last call to Dlerror. It returns an empty string if no errors have occurred since initialization or since it was last called.
func Dlopen ¶
Dlopen examines the dynamic library or bundle file specified by path. If the file is compatible with the current process and has not already been loaded into the current process, it is loaded and linked. After being linked, if it contains any initializer functions, they are called, before Dlopen returns. It returns a handle that can be used with Dlsym and Dlclose. A second call to Dlopen with the same path will return the same handle, but the internal reference count for the handle will be incremented. Therefore, all Dlopen calls should be balanced with a Dlclose call.
func Dlsym ¶
Dlsym takes a "handle" of a dynamic library returned by Dlopen and the symbol name. It returns the address where that symbol is loaded into memory. If the symbol is not found, in the specified library or any of the libraries that were automatically loaded by Dlopen when that library was loaded, Dlsym returns zero.
func NewCallback ¶
func NewCallback(fn interface{}) uintptr
NewCallback converts a Go function to a function pointer conforming to the C calling convention. This is useful when interoperating with C code requiring callbacks. The argument is expected to be a function with zero or one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr. Only a limited number of callbacks may be created in a single Go process, and any memory allocated for these callbacks is never released. At least 2000 callbacks can always be created. Although this function provides similar functionality to windows.NewCallback it is distinct.
func SyscallN ¶
SyscallN takes fn, a C function pointer and a list of arguments as uintptr. There is an internal maximum number of arguments that SyscallN can take. It panics when the maximum is exceeded. It returns the result and the libc error code if there is one.
NOTE: SyscallN does not properly call functions that have both integer and float parameters. See discussion comment https://github.com/ebiten/purego/pull/1#issuecomment-1128057607 for an explanation of why that is.
On amd64, if there are more than 8 floats the 9th and so on will be placed incorrectly on the stack.
The pragma go:nosplit is not needed at this function declaration because it uses go:uintptrescapes which forces all the objects that the uintptrs point to onto the heap where a stack split won't affect their memory location.
Types ¶
This section is empty.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
fakecgo
Package fakecgo implements the Cgo runtime (runtime/cgo) entirely in Go.
|
Package fakecgo implements the Cgo runtime (runtime/cgo) entirely in Go. |
|
Package objc is a low-level pure Go objective-c runtime.
|
Package objc is a low-level pure Go objective-c runtime. |