Documentation
¶
Index ¶
- Variables
- func CallFunction(cif *types.CallInterface, fn unsafe.Pointer, rvalue unsafe.Pointer, ...) error
- func CallFunctionContext(ctx context.Context, cif *types.CallInterface, fn unsafe.Pointer, ...) error
- func SetFuncSignature(returnType *types.TypeDescriptor, argTypes ...*types.TypeDescriptor) *types.CallInterface
- type SharedLibrary
Constants ¶
This section is empty.
Variables ¶
View Source
var ( VoidTypeDescriptor = types.VoidTypeDescriptor IntTypeDescriptor = types.IntTypeDescriptor FloatTypeDescriptor = types.FloatTypeDescriptor DoubleTypeDescriptor = types.DoubleTypeDescriptor UInt8TypeDescriptor = types.UInt8TypeDescriptor SInt8TypeDescriptor = types.SInt8TypeDescriptor UInt16TypeDescriptor = types.UInt16TypeDescriptor SInt16TypeDescriptor = types.SInt16TypeDescriptor UInt32TypeDescriptor = types.UInt32TypeDescriptor SInt32TypeDescriptor = types.SInt32TypeDescriptor UInt64TypeDescriptor = types.UInt64TypeDescriptor SInt64TypeDescriptor = types.SInt64TypeDescriptor PointerTypeDescriptor = types.PointerTypeDescriptor )
Functions ¶
func CallFunction ¶
func CallFunction(cif *types.CallInterface, fn unsafe.Pointer, rvalue unsafe.Pointer, avalue ...unsafe.Pointer) error
CallFunction calls fn (obtained using GetSymbol).
func CallFunctionContext ¶
func CallFunctionContext(ctx context.Context, cif *types.CallInterface, fn unsafe.Pointer, rvalue unsafe.Pointer, avalue ...unsafe.Pointer) error
CallFunctionContext calls fn (obtained using GetSymbol). It accepts a context for the first argument.
func SetFuncSignature ¶
func SetFuncSignature(returnType *types.TypeDescriptor, argTypes ...*types.TypeDescriptor) *types.CallInterface
SetFuncSignature configures the C function's signature (i.e. return value argument types).
Types ¶
type SharedLibrary ¶
type SharedLibrary struct {
// contains filtered or unexported fields
}
SharedLibrary represents a shared library that has been loaded and is ready to use.
func LoadLibrary ¶
func LoadLibrary(libBinary []byte) (*SharedLibrary, error)
LoadLibrary loads a shared library after being supplied with the binary for the library.
func (*SharedLibrary) GetSymbol ¶
func (l *SharedLibrary) GetSymbol(symbol string) unsafe.Pointer
GetSymbol returns a pointer to an exported function in the shared library.
func (*SharedLibrary) Unload ¶
func (l *SharedLibrary) Unload()
Unload can be called after the already loaded library is no longer needed.
Click to show internal directories.
Click to hide internal directories.