Documentation ¶
Overview ¶
Package callframe provides a way to create Godot-compatible callframes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame can be used to reduce the number of allocations required to pass pointers across API boundaries. Since dynamic function calls and CGO always cause pointers to escape, a frame enables a block of memory to be used to copy in const value arguments. The frame is cached using sync.Pool and recycled across calls. Suitable for use when the function being called is only borrowing the pointer for the lifetime of the call. A frame has a fixed size, if it runs out of space, arguments will be allocated onto the Go heap as usual.
type Ptr ¶
type Ptr[T comparable] struct { // contains filtered or unexported fields }
Ptr that does not escape as an allocation to the heap, T must be a value type that does not contain any pointers. The value must not be used after the frame has been freed.
func Arg ¶
func Arg[T comparable](frame *Frame, arg T) Ptr[T]
Arg adds a new argument to the call frame.
func Ret ¶
func Ret[T comparable](frame *Frame) Ptr[T]
Ret prepares an expected return value that will be available after the call has been made.
func (Ptr[T]) Uintptr ¶
Uintptr returns the uintptr value of the pointer. Useful for passing to C code.
func (Ptr[T]) UnsafePointer ¶
UnsafePoiner returns the unsafe.Pointer value of the pointer.